Text color looks faded when converting screenshot to WEBP

49 views Asked by At

I have tried using both imagemagick and The GIMP to convert a PNG to WEBP, but the text colors tend to fade after conversion.

Is there any way to tell WEBP to keep the colors strong?

The problem is most noticeable with lower resolution images, and with fully saturated primary colors.

1

There are 1 answers

0
joeytwiddle On

Yes! There are a bunch of options we can pass to the WEBP encoder through imagemagick.

After some experimentation, I found the option use-sharp-yuv=true kept the color saturation and intensity high, how I expected.

$ convert input.png -quality 95% -define webp:use-sharp-yuv=true output.webp

Using this option has a similar effect for lower quality conversions.

Disadvantages

  • As you can see from the example below, the file size is slightly larger when this option is enabled (18% in this case).
  • And for thin text (not shown), the color can even be brighter than it originally started! (Presumably interpolation overshooting.)

But for my purposes, I find enabling this option produces a result closer to the original.

Alternatives

The lossless=true option can also preserve the colors, but this prevents you from significantly reducing the filesize by tuning the quality.

Example

Original image (22.9K PNG):

Original image

Standard conversion to WEBP (18.1K, you can see that the colored text has faded, especially the thin magenta and dark blue characters):

Standard conversion to WEBP

Conversion to WEBP with use-sharp-yuv option enabled (21.3K, but colors are better):

Conversion to WEBP with option enabled