Results 1 to 3 of 3

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

  1. #1
    IV Newbie
    Join Date
    Jul 2020
    Posts
    2
    OS
    64-bit Win 10
    CPU Cores
    4

    Default 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:	16 
Size:	2.2 KB 
ID:	5915

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

Name:	test4b.png 
Views:	16 
Size:	15.2 KB 
ID:	5916

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

Name:	test4c.png 
Views:	15 
Size:	14.8 KB 
ID:	5917

    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. #2
    Moderator Enterprise User Bhikkhu Pesala's Avatar
    Join Date
    May 2007
    Location
    East London
    Posts
    6,481
    OS
    64-bit Win 10
    CPU Cores
    1

    Default

    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)

  3. #3
    IV Newbie
    Join Date
    Jul 2020
    Posts
    2
    OS
    64-bit Win 10
    CPU Cores
    4

    Default

    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:	10 
Size:	13.9 KB 
ID:	5918
    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:	9 
Size:	11.8 KB 
ID:	5919
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •