Page MenuHomePhabricator

Color accuracy from generated thumbnails
Open, Needs TriagePublic

Description

From Chealer's comment in T106240.

I noticed while sorting all our check mark variants that the color of some PNG conversions are slightly incorrect. The body of the check mark in the SVG has a color different from the body in the PNG, although the difference is hard to notice from naked eye. Cases I noticed:

  1. Green_check.svg, which has #088908 instead of the specified #118811.
  2. Check-green.svg, which has #008100 instead of the specified #008000.

Purging the cache does not fix.

Event Timeline

IIRC. SVG files are sRGB. PNG files do not have a default color space, but one can be declared. The PNG output by librsvg does not set the color space.

That could mean that librsvg is converting sRGB colors to a random color space used by the operating system.

I'm also curious about how the ultimate RGB values were determined. Are they examined in the PNG file or is a color picker used? It could also be possible that the PNG file has the expected sRGB values but a color picker is reading raw RGB values from the output device's bitmap.

@Glrx: If you're questioning the first number in the 2 cases provided, I certainly did not analyze the PNG file's contents. I must have used a color picker. This still reproduces at least with #1, using Firefox 137's color picker. Both now and back in October, I was testing with Firefox on Windows 11.

I copied the Green_check.svg thumbnail to my clipboard and then pasted it into https://onlinepngtools.com/analyze-png (a random tool on the internet)

The two most common pixels are the expected sRGB values:
#00000000 (602492 pixels, 74.38%) = rgba(0, 0, 0, 0.0)
#118811 (204103 pixels, 25.2%) = rgba(17, 136, 17, 1.0)

It does not show an RGB chunk.

librsvg should set the sRGB chunk.

https://www.w3.org/TR/png-3/#4Concepts.ColourSpaces

Looks like the color space is correct but the color picker reports the device values rather than the sRGB values..

I do not know about color spaces so am not able to comment on what librsvg does or should do. But my Windows 11 color picker is showing different values for the PNG and the SVG, so something has to be wrong. Unless Firefox is misdisplaying the SVG, the PNG is inexact.