qgis-js
qgis-js copied to clipboard
Colors in QGIS wasm in chromium look less bright (washed out)
It seems like Chrome does some color management which results in slightly dumper (less vivid) colors - when compared to QGIS Desktop and Firefox wasm rendering. One can see at in the blue of the rivers or the orange tones of the polygons above the shaded relief.
This is more an observation and not so much a bug.
@boardend : how to you transfer the rendered images from QGIS wasm to OpenLayers? As a JPEG or PNG encoded file? Can we influence color management in chrome?
Maybe it has to do with the fact that browsers behave differently for images where no color profile is embedded in the image - see this comparison table at https://www.benq.com/en-us/knowledge-center/knowledge/web-browsers-color-management.html
Perhaps this can be fixed by assigning the sRGB color profile to the rendered canvas image ?
Perhaps the above information at the BenQ website is outdated, but it is worth a try if the issue disappears by explicitly setting the sRGB color space to the rendered images, as explained here:
https://stackoverflow.com/questions/69274916/how-to-specify-color-space-for-canvas-in-javascript
Does setting the chrome://flags/#force-color-profile have an effect on this?
We can try to set srgb on the ImageData returned form the qgis-js API, as well as in the Canvas. (But this will be the default anyways, so in theory it should have no effect...)
PS: On my system (Ubuntu 22.04 with Wayland) the colors in Firefox and Chromium seem to look the same. I will have a go on some Windows machines over the weekend.
Does setting the
chrome://flags/#force-color-profilehave an effect on this?
Yes - there is a huge difference (on Windows 11). Setting it to sRGB makes the colors the same as in QGIS and Firefox, setting this preference to "Default" results in the washed out colors that I described.
Does this mean that there is nothing we could do here - and it is up to the user setting ?
The left side is with force-color-profile set to "default", the right side is when set to sRGB
One can probably also disable HDR in Windows while leaving Chromiums color profile on "default"?
Could you also do a test, what the following snippet prints to the console, if you paste it to the dev tools of FF and Chromium?
console.log("SDR:", window.matchMedia("(dynamic-range: standard)").matches)
console.log("HDR:", window.matchMedia("(dynamic-range: high)").matches)
Chrome 117.0.5938.150 (Official Build) (64-bit Windows):
console.log("SDR:", window.matchMedia("(dynamic-range: standard)").matches)
SDR: true
console.log("HDR:", window.matchMedia("(dynamic-range: high)").matches)
HDR: false
Firefox 117.0.1 (64-Bit Windows):
console.log("SDR:", window.matchMedia("(dynamic-range: standard)").matches)
SDR: true debugger eval code:1:9
console.log("HDR:", window.matchMedia("(dynamic-range: standard)").matches)
HDR: true debugger eval code:1:9