WebP Color Discrepancy
See original GitHub issueDescribe the bug Map tiles loaded by Java using the TwelveMonkeys WEBP ImageIO reader have inconsistent colors. The file is converted from a PNG file which is all “ocean” pixels with sRGB values of (112, 173, 215). The WEBP codec returns different values, which vary slightly based on whether there are other non-“ocean” pixels in the map tile. The most common codec color for the loaded WEBP is an sRGB of (111, 165, 202).
Version information
- The version of the TwelveMonkeys ImageIO library in use.
It happens in both the 3.7.1 version and the 3.8-SNAPSHOT version (which includes the fix to #609)
- The exact output of
java --version
(orjava -version
for older Java releases).
openjdk 14.0.2 2020-07-14 OpenJDK Runtime Environment (build 14.0.2+12-46) OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)
- Extra information about OS version, server version, standalone program or web application packaging, executable wrapper, etc. Please state exact version numbers where applicable.
MacOS 11.5.1 x86_64, run from Netbeans 12.4 directly as an executable application.
To Reproduce
This WEBP file loads correctly in web browsers but the colors are off in Java: https://www.runningreality.org/lib/map/tiles/8/136/97.webp
The file is converted from this PNG file: https://www.runningreality.org/lib/map/tiles/8/136/97.png
The conversion was done using the command: cwebp -m 6 -q 85 -mt -af -progress -sharp_yuv
Expected behavior Expect the WEBP to load with the exact color values as the PNG.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
That seems to have eliminated 99% of the issue! The map tiles are all rendering with the correct colors, except for a small handful (5 out of about >150 checked so far). I’ll see if there is anything specific about those images that causes the problem. Still, those tiles that are off are off by only a tiny amount that is only noticeable because they are map tiles arranged adjacent to other correct tiles. (Attached is a pic of four tile intersection with two tiles slightly off)
That does indeed seem like it fits all of the symptoms exactly. I can imagine that there are some circumstances where some of the integer rounding might produce a value that is off by 1 between PNG and WEBP, so that might not even technically be a bug.
I really appreciate that you are queuing up this fix. Your work to bring a solid implementation of the WEBP format to Java is of enormous benefit to the community. Thank you.