You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
CMYK JPEG image shows wrong colors (black is ok)
Version information
The version of the TwelveMonkeys ImageIO library in use.
For example: 3.9.4
The exact output of java --version (or java -version for older Java releases).
java version "11.0.20" 2023-07-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.20+9-LTS-256)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.20+9-LTS-256, mixed mode)
Extra information about OS version, server version, standalone program or web application packaging, executable wrapper, etc. Please state exact version numbers where applicable.
Windows Version 10.0.19045.3570
To Reproduce
Steps to reproduce the behavior:
Compile the below sample code
Download the sample image file
Run the code with the sample file
See error
output:
BufferedImage@12d4bf7e: type = 5 ColorModel: #pixelBits = 24 numComponents = 3 color space = java.awt.color.ICC_ColorSpace@70be0a2b transparency = 1 has alpha = false isAlphaPre = false ByteInterleavedRaster: width = 2551 height = 3697 #numDataElements 3 dataOff[0] = 2
true
Expected behavior
That the saved file would look mostly the same
Example code
BufferedImage bim = ImageIO.read(new File("xx.jpg"));
System.out.println(bim);
boolean b = ImageIO.write(bim, "png", new File("xx-saved.png"));
System.out.println(b);
Additional context
It happens in PDFBox, so I assume the problem isn't when saving the file. Etienne-Gautier/pdfbox#1
I'm trying to understand what's going on here, the file has an Adobe marker with YCCK transform, yet it seems it's encoded as plain CMYK... No, wait, the file has TWO Adobe markers. 😮😕🤬
The first has YCCK transform, the second has "unknown" transform (assumed to be CMYK).
I'm not sure if this is intentional by the software that wrote it, but it's really not good for anything but confusing reader software... 😛 I can change the TwelveMonkeys code to use the last occurrence of an Adobe marker instead of the first. Which in 99.99% of the time would be the same (the only one). This is likely what other software does, as it displays the image as intended. But it seems more like an arbitrary decision/coincidence than the "correct" thing to do...
Describe the bug
CMYK JPEG image shows wrong colors (black is ok)
Version information
The version of the TwelveMonkeys ImageIO library in use.
For example: 3.9.4
The exact output of
java --version
(orjava -version
for older Java releases).java version "11.0.20" 2023-07-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.20+9-LTS-256)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.20+9-LTS-256, mixed mode)
Windows Version 10.0.19045.3570
To Reproduce
Steps to reproduce the behavior:
output:
BufferedImage@12d4bf7e: type = 5 ColorModel: #pixelBits = 24 numComponents = 3 color space = java.awt.color.ICC_ColorSpace@70be0a2b transparency = 1 has alpha = false isAlphaPre = false ByteInterleavedRaster: width = 2551 height = 3697 #numDataElements 3 dataOff[0] = 2
true
Expected behavior
That the saved file would look mostly the same
Example code
Additional context
It happens in PDFBox, so I assume the problem isn't when saving the file.
Etienne-Gautier/pdfbox#1
files as zip:
xx.zip
The text was updated successfully, but these errors were encountered: