Open Bug 1599336 Opened 5 years ago Updated 2 years ago

Downscaling of images: averagin done on sRGB channels instead linear space

Categories

(Core :: Graphics: Color Management, defect, P3)

70 Branch
Unspecified
Windows 10
defect

Tracking

()

Tracking Status
firefox-esr68 --- affected
firefox70 --- affected
firefox71 --- affected
firefox72 --- affected

People

(Reporter: arnaud.cheritat, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached image img.jpg

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

In short: Open img.png. Look at the four gray areas. Then press CTRL-minus a certain number of times. Compare.

In details: The left part contains a checkerboard pattern of pure white (255,255,255) and pure black (0,0,0). The right part contains a uniform zone where the channels RGB are (128,128,128) on top and (188,188,188) on the bottom. The image is a JPG whose EXIF indicates that its channels were encoded in sRGB color space (but the bug is not specific to these facts).

Actual results:

In short: Before unzooming, checkered part on the bottom left and top left (they are identical) look like bottom right. After unzooming, checkered part suddenly gets darker, more like top right.

In details: FF has correctly displayed the image when there was no scaling factor. It was indeed in sRGB and since my laptop os+screen is approximately displaying using the sRGB convention, this looks right: in the bottom line, the left and right parts have a very close color seen from some distance. When I asked FF to downscale the image, it averaged the RGB channel, which is wrong, because in sRGB convention, the channel value is not in linear correspondence with the luminosity. In this example, this is very prominently wrong.

Expected results:

In short: The checkered part on the left should retain its brightness.

In details: It should appear of a shade close to R, G and B channel 188, 188, 188, which corresponds to 50% gray in sRGB system.

Request: This innapropriate behaviour of the browser does not impact only JPEG images but is generalized to all file formats (I reproduced it with a PNG in sRGB). It is not specific to sRGB colorspace either (I reproduced the sudden darkening effect with a PNG with gamma=1). It has been so for more than 10 years. It is time to correct that.

Of course I meant img.jpg, not img.png.

Hello,
I have managed to reproduce the issue using the latest FF release 70.0.1, Beta 71 and Nightly 72.0a1 (2019-12-01) on Windows 10. I have also set the component for the bug; if you feel that this is the wrong component, please assign the correct one.

Status: UNCONFIRMED → NEW
Component: Untriaged → GFX: Color Management
Ever confirmed: true
Product: Firefox → Core
OS: Unspecified → Windows 10
Flags: needinfo?(aosmond)
Priority: -- → P3

This is something we should keep in mind if/when we transition to doing more image decoding/caching using the GPU. If image decoding lived in the GPU process, we eliminated the CPU cache and relied upon a more extensive GPU cache, then doing these sorts of transforms could be done far more efficiently.

Blocks: 1602453
Flags: needinfo?(aosmond)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: