Announcement

Collapse
No announcement yet.

Add an option for WebP "Sharp YUV" mode when saving .webp files.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Requested Add an option for WebP "Sharp YUV" mode when saving .webp files.

    The WEBP image format has an option that significantly improves colored edges for WEBP files, it's called "sharp_yuv", and is typically not enabled by default.

    Test image #1: Original File
    Click image for larger version

Name:	test4.png
Views:	1
Size:	2.2 KB
ID:	85326

    Test image #2: Saved as lossy WEBP (quality 95) with sharp_yuv
    Click image for larger version

Name:	test4b.png
Views:	1
Size:	15.2 KB
ID:	85327

    Test image #3: Saved as lossy WEBP (quality 95) without sharp_yuv (default)
    Click image for larger version

Name:	test4c.png
Views:	1
Size:	14.8 KB
ID:	85328

    Click on the images to enlarge them. Have a close look at the edges. When you're not using Sharp_YUV, there is a black halo added around all the color edges. Sharp_YUV greatly reduces this artifact.

    To turn this on, you set "use_sharp_yuv" within the WebPConfig struct to 1, before calling WebPEncode.

    #2
    This image seems like a bad example to use for demonstrating the advantages of WebP format. The original PNG image is a lossless format, but substantially smaller than the WebP examples. In my quick test:

    PNG = 2,456 Bytes (with transparency)
    WebP = 4,772 Bytes (without transparency)
    Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

    Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

    Comment


      #3
      I'm not comparing the merits of one image format over another, I'm pointing out a specific type of artifact that you can get from Lossy image formats. I'm just using simple images with a red edge against a white background to show what happens to this kind of edge.

      Usually, the first step in lossy compression is to perform Chroma Subsampling.
      This is where the colors of the image are changed from RGB into full-resolution Luma, and half-resolution Chroma. The Chroma is "subsampled", or reduced in size to 1/4 as many pixels.
      Even if you saved a JPEG at 100% quality, you've already thrown out color information. This introduces dark edge artifacts near the boundaries of color and white, or colors and other colors.

      Click image for larger version

Name:	test4_100.jpg
Views:	1
Size:	13.9 KB
ID:	83488
      Example, JPEG at 100% quality, but Chroma Subsampling has already wrecked the image

      But JPEG lets you turn Chroma Subsampling off when you save a file. This skips the step where color information is reduced to half-resolution. This keeps the edges from getting messed up.

      Click image for larger version

Name:	test4_no_subsampling.jpg
Views:	1
Size:	11.8 KB
ID:	83489
      Example, JPEG with chroma subsampling turned off. Edges between colors and white, and colors and other colors are preserved.

      Lossy WEBP is a lot like JPEG, it performs Chroma Subsampling. Unlike JPEG, WEBP does not provide a way to completely disable Chroma Subsampling. But it has a similar way to reduce the artifacts that normally come with Chroma Subsampling, and that is the "sharp_yuv" option.

      When saving JPEGs, IrfanView has a checkbox for disabling Chroma Subsampling, but it does not have a checkbox for "sharp_yuv" when writing WEBP files.

      Comment

      Working...
      X