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

Remove TurboJPEG from Cantaloupe (disabling as processor is not enough?) to allow PDF Y coordinate level tiling #60

Open
DiegoPino opened this issue Jun 16, 2023 · 8 comments
Assignees
Labels
bug Something isn't working esmero-cantaloupe IIIF goodness in docker package Replicate? Help making this fail so we can fix it

Comments

@DiegoPino
Copy link
Member

DiegoPino commented Jun 16, 2023

See cantaloupe-project/cantaloupe#482

For some reason (explained there) when turbojpeg is around PDF tiling on Y coordinate is dead. Unmaintained lately, was fixed in 5.02, broke again in 5.04, and of course broken on our 6.x. I will try to fix our Fork's and might also introduce the PDF rendering flag we discussed a few months ago to make rendering more memory efficient

@DiegoPino DiegoPino self-assigned this Jun 16, 2023
@DiegoPino DiegoPino added bug Something isn't working esmero-cantaloupe IIIF goodness in docker package Replicate? Help making this fail so we can fix it labels Jun 16, 2023
@DiegoPino DiegoPino changed the title Remove TurboJPEG from Cantaloupe (disable is not enough) to allow PDF Y coordinate level tiling Remove TurboJPEG from Cantaloupe (disabling as processor is not enough?) to allow PDF Y coordinate level tiling Jun 16, 2023
@DiegoPino
Copy link
Member Author

See cantaloupe-project/cantaloupe#482 (comment)

I will fork and point our docker to a new branch instead

@patdunlavey
Copy link

@DiegoPino fyi, we found that switching to the 6.0.0-noturbojpeg-multiarch container image fixed our grayscale jp2 problem! I did test the 6.0.1-multiarch image, and it does not fix it.

We're going to test that noturbojpeg image on a staging site for a while to see if we find any problems.

@DiegoPino
Copy link
Member Author

@patdunlavey thanks. So turbojpeg is to blame? It is deeply built into Cantaloupe so other than removing it from the build (and disabling it from the output) there is nothing I can do. Did you test https://hub.docker.com/layers/esmero/cantaloupe-s3/6.0.1-multiarch/images/sha256-a0b56db3d40dd7818e5c2fd3e62668af8ef5e045c45f23fe0e5bfb45ad60d0e4?context=explore with JPEG processing being Java2D?

@patdunlavey
Copy link

I did not try that. I will give that a test!

@patdunlavey
Copy link

patdunlavey commented Aug 21, 2023

Thanks for pointing out what I should have noticed would be an obvious change needed in cantaloupe.properties when libjpeg-turbo is removed. But in further testing, what I didn't expect, is that having processor.ManualSelectionStrategy.jpg = TurboJpegProcessor, when using the 6.0.0-noturbojpeg-multiarch image, seems to work just fine!
Perhaps cantaloupe's TurboJpegProcessor fails back to use Java2D automatically if TurboJpeg is not found?

Update: I'm sorry that I did not answer your question about testing with 6.0.1-multiarch.

I tested esmero/cantaloupe-s3/6.0.1-multiarch, with and without the jpg processing being Java2D. For jpg files it makes no difference - they succeed. For jp2 files, it also makes no difference - they fail.

@patdunlavey
Copy link

I should clarify/emphasize that the jp2 files that fail are grayscale. It seems that color jp2s work fine with libjpeg-turbo installed.

@DiegoPino
Copy link
Member Author

@patdunlavey yes Derek explained your issue with B&W JP2s on slack. Only real way of getting TurboJPEG out of the way is removing the library as I did in https://hub.docker.com/layers/esmero/cantaloupe-s3/6.0.0-noturbojpeg-multiarch/images/sha256-6ab80b37755c4cdb97b093fe5283aaa47c73aa19e8421235ac841ff3c3f7bf67?context=explore

Probably the issue is on the writer (which as you detected will not be used if the library is not present)...

https://github.com/cantaloupe-project/cantaloupe/blob/21057cf72071840e2a984450bf8845c6e6490ec9/src/main/java/edu/illinois/library/cantaloupe/processor/codec/jpeg/TurboJPEGImageWriter.java#L18

but also there is this very old ISSUE open which matches the issue you are seeing with greyscale...
cantaloupe-project/cantaloupe#190

There is a pull that addressed one of the problems but not the actual intermediate BMP issue with low bit colors. You all sure Kakadu did not work for this?

@DiegoPino
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working esmero-cantaloupe IIIF goodness in docker package Replicate? Help making this fail so we can fix it
Projects
None yet
Development

No branches or pull requests

2 participants