gotson / komga

Media server for comics/mangas/BDs/magazines/eBooks with API, OPDS and Kobo Sync support
https://komga.org
MIT License
3.89k stars 232 forks source link

cannot decode JXL with grayscale ICC profile #1289

Closed browningluke closed 10 months ago

browningluke commented 10 months ago

Steps to reproduce

  1. Launch docker image with 1.6.4
  2. Open book containing jxl files.
  3. Observe the correct pages shown.
  4. Launch docker image pointing to library with version 1.7.0 or 1.7.1
  5. Open same book containing jxl files.
  6. Observe a black screen with the Page x printed instead of the pages. Logs attached are visible in the docker container.

Expected behavior

Prior to v1.7.0, the jxl pages would convert perfectly to jpegs for all the books in my library. Opening a book with jxl images would work as intended.

Actual behavior

As of v1.7.0, the jxl pages fail to load with a black screen. These files are exactly the same, and I can downgrade to v1.6.4 to return the functionality.

Logs

Caused by: java.lang.IllegalArgumentException: colorSpace is not of type TYPE_RGB!
 at java.desktop/javax.imageio.ImageTypeSpecifier$Packed.<init>(Unknown Source) ~[na:na]
 at java.desktop/javax.imageio.ImageTypeSpecifier.createPacked(Unknown Source) ~[na:na]
 at com.twelvemonkeys.imageio.util.ImageTypeSpecifiers.createPacked(ImageTypeSpecifiers.java:116) ~[imageio-core-3.9.4.jar:3.9.4]
 at com.github.gotson.nightmonkeys.jxl.imageio.plugins.JxlImageReader.readInfo(JxlImageReader.java:45) ~[imageio-jxl-0.6.0.jar:0.6.0]
 at com.github.gotson.nightmonkeys.jxl.imageio.plugins.JxlImageReader.getNumImages(JxlImageReader.java:66) ~[imageio-jxl-0.6.0.jar:0.6.0]
 at com.twelvemonkeys.imageio.ImageReaderBase.checkBounds(ImageReaderBase.java:190) ~[imageio-core-3.9.4.jar:3.9.4]
 at com.github.gotson.nightmonkeys.jxl.imageio.plugins.JxlImageReader.readInfo(JxlImageReader.java:54) ~[imageio-jxl-0.6.0.jar:0.6.0]
 at com.github.gotson.nightmonkeys.jxl.imageio.plugins.JxlImageReader.read(JxlImageReader.java:101) ~[imageio-jxl-0.6.0.jar:0.6.0]
 ... 175 common frames omitted

logs-from-komga-in-komga-0(1).log

Komga version

1.7.1

Operating system

Debian

Installation method

Docker

Other details

No response

Acknowledgements

darthmooguy commented 10 months ago

I've observed the same bug. However, for me it only happens with jxl that were converted from a jpeg with the greyscale color space. Komga can read the jpeg just fine, but the converted jxl file throws the invalid color space error. I have other jxl files that work in 1.7.1 though. It seems like a decoder bug (introduced with the nightmonkeys update maybe?), as I can open the jxl files that Komga can't read with other jxl compatible software.

browningluke commented 10 months ago

as I can open the jxl files that Komga can't read with other jxl compatible software.

Same here, these images work fine in other software, and in v1.6.4.

I have other jxl files that work in 1.7.1 though.

After looking through my library, I've found a couple of pages that work too. They're usually just pages with color, and the rest of the grayscale pages fail to convert.

gotson commented 10 months ago

Can you provide the file?

browningluke commented 10 months ago

Can you provide the file?

@gotson Here is a truncated version (as to not distribute copyrighted material) of one file that partly works. The first 3 images render perfectly on both v1.6.4 and v1.7.1, but the last 2 pages only render on v1.6.4.

bugexample.zip

gotson commented 10 months ago

fixed upstream in https://github.com/gotson/NightMonkeys/commit/8b5651fd8770e91422bc56a2782e28166843f5b2

browningluke commented 10 months ago

Brilliant! Thanks for your awesome and hard work @gotson :)

github-actions[bot] commented 10 months ago

🎉 This issue has been resolved in 1.7.2 (Release Notes)