haraldk / TwelveMonkeys

TwelveMonkeys ImageIO: Additional plug-ins and extensions for Java's ImageIO
https://haraldk.github.io/TwelveMonkeys/
BSD 3-Clause "New" or "Revised" License
1.89k stars 313 forks source link

WebP: Significant color distortion on "long" and lossy images #785

Open rzam opened 1 year ago

rzam commented 1 year ago

Describe the bug I'm noticing a color distortion when reading "big" (≥ ~4k-5k pixels in width or height) and lossy (generated with cwebp -q 75) WEBP images and converting them to other formats.

The distortion seems to be very significant when reading "long" (~5k+ pixels in height) WEBPs and less noticeable when reading "wide" (~5k+ pixels in width) WEBPs; WEBPs generated with a higher quality setting (eg. cwebp -q 100) seem unaffected.

Version information TwelveMonkeys version (Gradle):

implementation("com.twelvemonkeys.imageio:imageio-webp:3.9.4")

Java version:

openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)

OS:

OS Name:                   Microsoft Windows 11 Pro
OS Version:                10.0.22000 N/A Build 22000

cwebp version:

1.3.1
libsharpyuv: 0.2.1

Example code All images in the screenshots below were read and written using the standard ImageIO methods, eg.:

BufferedImage image = ImageIO.read(new File("long.cwebp.q75.webp"));
ImageIO.write(image, "png", new File("long.imageio.q75.png"));

Sample file(s) sources.zip

Screenshots Example using a "long" (500x5000) gradient: example long

Example using a "wide" (5000x500) gradient: example wide

haraldk commented 1 year ago

Hi,

Thanks for reporting! There seems to be some kind of error that is accumulated in the vertical dimension, but I will need to investigate...

Unfortunately, I don't have any time to look into this at the moment, but I will as soon as I find the time (August/September). If you can dig some more in the mean time, that would be very helpful! 😀

haraldk commented 10 months ago

as soon as I find the time (August/September).

That didn't age too well... 😛