Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read JPEG2000 image: Java Advanced Imaging (JAI) Image I/O Tools are not installed #50

Closed
sardaukar opened this issue Jan 2, 2020 · 11 comments
Labels
bug Something isn't working released

Comments

@sardaukar
Copy link

I have a few JPEG2000 PDFs I guess, and Komga just generates blank covers and pages (with no error on the UI, but the title of the issue shows up in the log file).

Example file

@gotson
Copy link
Owner

gotson commented Jan 3, 2020

I looked up the thing with jpeg2000, and it's complicated :/

There was a project stopped in 2010, which is still available but has a dodgy license. There seems to be another project that could provide the feature, but i would need to try what that means in terms of added dependencies and portability.

Just to have an idea, how many of those jpeg2000 PDFs do you have?

@gotson gotson added the bug Something isn't working label Jan 3, 2020
@gotson
Copy link
Owner

gotson commented Jan 3, 2020

I managed to add some dependencies that helps with JPEG2000 as well as the JBIG2 compression format (which is apparently used in your file). The code can read the files.

Now i'm faced with another problem, as the files are considered jpeg, they are sent to the browser as is, but the browser cannot read them and display a blank image instead.

I need to figure out how to detect that the images are jpeg2000 in the PDF and convert them to classic jpeg.

@gotson
Copy link
Owner

gotson commented Jan 3, 2020

I had the browser cache enabled, which was loading the previous blank page. After disabling the browser cache it works fine.

@gotson
Copy link
Owner

gotson commented Jan 3, 2020

@sardaukar assuming you are using docker, would you be able to try the latest gotson/komga:beta and confirm it it solves your issues?

@gotson gotson added the waiting for feedback Waiting for a feedback from the issue creator label Jan 4, 2020
@sardaukar
Copy link
Author

Trying it now.

@sardaukar
Copy link
Author

sardaukar commented Jan 4, 2020

Well, it seems to have fewer errors in the logs, but the web UI still stops working after a while. The scanner still seems to be working, but after

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "http-nio-8080-ClientPoller"

shows up, the web UI is unresponsive and reloading it just gives me 504s.

@sardaukar
Copy link
Author

A lot of

2020-01-04 15:03:59.631  INFO 1 --- [kTaskExecutor-2] org.hibernate.orm.cache                  : HHH90001005: Cache[cache.media.collection.pages] Key[org.gotson.komga.domain.model.Media._pages#27123]
A soft-locked cache entry was expired by the underlying cache. If this happens regularly you should consider increasing the cache timeouts and/or capacity limits
2020-01-04 15:03:59.634  INFO 1 --- [kTaskExecutor-2] o.h.c.s.support.AbstractReadWriteAccess  : Cached entry expired : org.gotson.komga.domain.model.Media._pages#27123

still.

@sardaukar
Copy link
Author

I'll let the scanner finish and then restart the container to see if the web UI comes back.

@sardaukar
Copy link
Author

sardaukar commented Jan 4, 2020

I also see a few

java.util.NoSuchElementException: List is empty.
        at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:196) ~[kotlin-stdlib-1.3.61.jar:1.3.61-release-180 (1.3.61)]
        at org.gotson.komga.domain.service.BookAnalyzer.analyze(BookAnalyzer.kt:53) ~[app/:na]
        at org.gotson.komga.domain.service.BookLifecycle.analyzeAndPersist(BookLifecycle.kt:35) ~[app/:na]
        at org.gotson.komga.domain.service.BookLifecycle$$FastClassBySpringCGLIB$$6608c007.invoke(<generated>) ~[app/:na]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:366) ~[spring-tx-5.2.2.RELEASE.jar:5.2.2.RELEASE]
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99) ~[spring-tx-5.2.2.RELEASE.jar:5.2.2.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
        at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
        at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]

and here's the unzip test output for the file mentioned before this in the log:

Archive:  IDW Ultimate Collection (2002-2017)/24 (001-005)(2014).zip                                                                          
    testing: 24 (001-005)(2014)/      OK
    testing: 24 (001-005)(2014)/24 002 (2014) (digital) (Minutemen-Slayer).cbr   OK                                                                             
    testing: 24 (001-005)(2014)/24 004 (2014) (digital) (Minutemen-Slayer).cbr   OK                                                                             
    testing: 24 (001-005)(2014)/24 001 (2014) (digital) (Minutemen-Slayer).cbr   OK                                                                             
    testing: 24 (001-005)(2014)/24 005 (2014) (digital) (Minutemen-Slayer).cbr   OK                                                                             
    testing: 24 (001-005)(2014)/24 003 (2014) (digital) (Minutemen-Slayer).cbr   OK                                                                             
No errors detected in compressed data of IDW Ultimate Collection (2002-2017)/24 (001-005)(2014).zip.                                          

Looks like this just contains other comics files, have to unzip it.

@gotson
Copy link
Owner

gotson commented Jan 5, 2020

I hoped you could try a smaller library just with the jpeg2000 files to confirm it works 😅

@gotson gotson closed this as completed in 227975a Jan 6, 2020
gotson pushed a commit that referenced this issue Jan 6, 2020
# [0.11.0](v0.10.1...v0.11.0) (2020-01-06)

### Bug Fixes

* **web reader:** remove webp as it's not supported in Safari ([6770107](6770107))
* add support for jpeg2000/jbig2 formats ([227975a](227975a)), closes [#50](#50)

### Features

* handle archives without images ([70a2da5](70a2da5)), closes [#56](#56)
* **web reader:** rtl option ([98efa9b](98efa9b)), closes [#53](#53)
* display version in UI ([4085f1f](4085f1f)), closes [#42](#42)
* rescan library ([30208a2](30208a2)), closes [#38](#38)
* **api:** reAnalyze library ([fa65e94](fa65e94))
* **api:** reAnalyze series ([e80451f](e80451f))
* **rest api:** ability to re-analyze a book ([8e81356](8e81356)), closes [#51](#51)
* **rest api:** don't return hidden files for directory listings ([a478d90](a478d90))
* **webui:** add menu option to analyze book from browsing view ([64f542d](64f542d)), closes [#51](#51)
* **webui:** reAnalyze library ([b599b72](b599b72)), closes [#51](#51)
* **webui:** reAnalyze series ([b997561](b997561))
@gotson
Copy link
Owner

gotson commented Jan 6, 2020

🎉 This issue has been resolved in version 0.11.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@gotson gotson added released and removed waiting for feedback Waiting for a feedback from the issue creator labels Jan 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

2 participants