User:Mykhal/WikiPNGRenderingTest
This page demonstrates an interesting but undesired phenomenon of different appearance of different encodings of the same original PNG image after processing (scaling) on Wiki(p|m)edia servers – (currently, ) grayscale PNG images appear to be lighter (gray-er) than their monochrome or RGB variants.
Please note that the phenomenon applies for the image wiki pages as well, as they contain downscaled image versions. The inspection for original visual identity must take one step (click) further.. (URL must be like https://upload.wikimedia.org/wikipedia/en/.../.../WikiPNGRenderingTest_....png
)
Original PNGs are made with GIMP.
(Note: I wonder why the transparent variants are not shown transparent.. is there some different processing on commons vs en servers?)
Discussed here.
Test A
[edit]-
RGB
-
Grayscale
-
Monochrome
-
Transparent RGB
-
Transparent Grayscale
-
Transparent Monochrome
-
RGB+α
-
Grayscale+α
(Does not apply for the transparent versions, somehow..?)
Screenshots:
Test B
[edit]More obvious and convincing one (no transparency browser-dependent rendering, no (anti)aliasing differences in the original images), seamless pattern and seamless side-by-side comparison.
RGB / Grayscale / Monochrome (downscaled by Wiki*edia servers)
RGB / Grayscale (pre-downscaled thumbs, original size)
.. more experimenting:
RGB / Grayscale, thumbs further downscaled by Wiki*edia to >50%.. looks the same (I have just noted that it applies for Chrome, NOT for FF !?!)
RGB / Grayscale, thumbs downscaled by Wiki*edia to <50%.. the anomaly appears again
The monochrome image was generated with Python Imaging Library (Pillow):
import PIL.Image
img = PIL.Image.new("1", (1024, 1024))
for i in range(32):
for j in range(i+1):
y = i*32 + j
for x in range(1024):
img.putpixel((x, y), 1)
img.save("/tmp/out.png", "PNG")
.. inverted, and converted to grayscale and RGB encodings. Those two encoded images are further downscaled to 128px in GIMP to demonstrate, that if they are not downscaled by the server, they are OK – the same.
Screenshots:
Cause
[edit]More observations show that the presence of the anomaly is browser dependent. E.g. on Windows 7 platform, it appears in MSIE 8 browser, but not in MSIE 9 or Win8/MEIS 11.
Principal observation
[edit]PNG gamma value in the original images is set to 0.454545 (because the colorspace is sRGB – GIMP default?). This gamma value is preserved in the Wiki*edia servers processed/scaled images (or just lightly changed to 0.45455 probably by some rounding), except from the grayscale PNG images – they have the gamma value changed to 1.
(I have verified that simple Imagemagick scale convert operation is preserving the gamma value in both RGB and Grayscale images.)