cantaloupe-project / cantaloupe

High-performance dynamic image server in Java
https://cantaloupe-project.github.io/
Other
270 stars 111 forks source link

"IllegalArgumentException: Unknown image type 0" for tiff resized to 1x1 #282

Closed mmatela closed 5 years ago

mmatela commented 5 years ago

My UniversalViewer sometimes sends requests like this: /iiif/2/test.tiff/full/1,/0/default.jpg

This results in error in Cantaloupe:

An exception occurred writing the response entity
java.lang.IllegalArgumentException: Unknown image type 0
    at java.awt.image.BufferedImage.<init>(BufferedImage.java:501)
    at edu.illinois.library.cantaloupe.processor.Java2DUtil.scale(Java2DUtil.java:934)
    at edu.illinois.library.cantaloupe.processor.AbstractJava2DProcessor.doPostProcess(AbstractJava2DProcessor.java:299)
    at edu.illinois.library.cantaloupe.processor.AbstractJava2DProcessor.postProcess(AbstractJava2DProcessor.java:132)
    at edu.illinois.library.cantaloupe.processor.Java2dProcessor.process(Java2dProcessor.java:56)
    at edu.illinois.library.cantaloupe.resource.ImageRepresentation.doWrite(ImageRepresentation.java:180)
    at edu.illinois.library.cantaloupe.resource.ImageRepresentation.write(ImageRepresentation.java:93)
    at org.restlet.engine.adapter.ServerCall.writeResponseBody(ServerCall.java:513)

This seems to happen for all tiff files and not for other formats. Here's my sample:

test.zip

I'm using default configuration, tested on Cantaloupe 4.0.2 and 4.1. There's no error for bigger sizes, for example /iiif/2/test.tiff/full/5,/0/default.jpg

adolski commented 5 years ago

Thanks for reporting, @mmatela!