cantaloupe-project / cantaloupe

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

pyramidal tiff: why scale? #472

Closed jbarth-ubhd closed 3 years ago

jbarth-ubhd commented 3 years ago

I've tried our manifest https://heidicon.ub.uni-heidelberg.de/manifest/iiif/1139791/manifest.json (image in sequences[0].canvases[1]) with mirador viewer, and one of the requests is

2021-04-16 08:23:21,562 INFO [qtp586617651-1969] e.i.l.c.r.i.v.ImageResource [AbstractResource.java:117] Handling GET /⸗
iiif/2/1139791:708192/24576,11264,1024,1024/512,/0/default.jpg
...
2021-04-16 08:23:21,581 DEBUG [qtp586617651-1969] e.i.l.c.s.HttpSource [HTTPStreamFactory.java:84] newSeekableStream():⸗
 using 524288-byte chunks
2021-04-16 08:23:21,582 DEBUG [qtp586617651-1969] e.i.l.c.p.c.TIFFImageReader [AbstractIIOImageReader.java:93] Using it⸗
.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader
2021-04-16 08:23:21,582 DEBUG [qtp586617651-1969] e.i.l.c.p.c.TIFFImageReader [AbstractIIOImageReader.java:106] Ignorin⸗
g metadata? true
2021-04-16 08:23:21,634 DEBUG [qtp586617651-1969] e.i.l.c.p.c.TIFFImageReader [AbstractIIOImageReader.java:506] Acquiri⸗
ng region 24576,11264/1024x1024 from 26315x19908 image (256x256 tile size)
2021-04-16 08:23:22,130 DEBUG [qtp586617651-1969] e.i.l.c.p.Java2DUtil [Java2DUtil.java:1004] scale(): scaled 1024x1024⸗
 image to 512x512 using a BiCubic filter in 233 msec

Why does cantaloupe scale? The image in the second tiff directory has the wanted scale, and the mirador request perfectly matches the 256×256 tiles in this image.

adolski commented 3 years ago

Please see https://github.com/cantaloupe-project/cantaloupe/issues/296#issuecomment-819826920

jbarth-ubhd commented 3 years ago

see https://digi.ub.uni-heidelberg.de/diglitData/v/Rubens-tile94-deflate.tif

complete log: https://digi.ub.uni-heidelberg.de/diglitData/v/application.log

jbarth-ubhd commented 3 years ago

oops trace \< debug

adolski commented 3 years ago

Good catch, @jbarth-ubhd. FYI, here is the log output that I was looking for:

12:54:12.483 [qtp1188401255-33] TRACE e.i.l.c.p.c.TIFFImageReader - Detected 10 subimage(s)
12:54:12.483 [qtp1188401255-33] TRACE e.i.l.c.p.c.TIFFImageReader - Subimage 10: 51x38 - too small
12:54:12.483 [qtp1188401255-33] TRACE e.i.l.c.p.c.TIFFImageReader - Subimage 9: 102x77 - too small
12:54:12.483 [qtp1188401255-33] TRACE e.i.l.c.p.c.TIFFImageReader - Subimage 8: 205x155 - too small
12:54:12.483 [qtp1188401255-33] TRACE e.i.l.c.p.c.TIFFImageReader - Subimage 7: 411x311 - too small
12:54:12.483 [qtp1188401255-33] TRACE e.i.l.c.p.c.TIFFImageReader - Subimage 6: 822x622 - too small
12:54:12.484 [qtp1188401255-33] TRACE e.i.l.c.p.c.TIFFImageReader - Subimage 5: 1644x1244 - too small
12:54:12.484 [qtp1188401255-33] TRACE e.i.l.c.p.c.TIFFImageReader - Subimage 4: 3289x2488 - too small
12:54:12.484 [qtp1188401255-33] TRACE e.i.l.c.p.c.TIFFImageReader - Subimage 3: 6578x4977 - too small
12:54:12.484 [qtp1188401255-33] TRACE e.i.l.c.p.c.TIFFImageReader - Subimage 2: 13157x9954 - too small
12:54:12.484 [qtp1188401255-33] TRACE e.i.l.c.p.c.TIFFImageReader - Subimage 1: 26315x19908 - fits! (0x reduction factor)
12:55:24.761 [qtp1188401255-33] DEBUG e.i.l.c.p.c.TIFFImageReader - Acquiring region 24576,11264/1024x1024 from 26315x19908 image (96x96 tile size)

I think this is a floating-point comparison bug and subimage 2 should be chosen instead. I will push a fix shortly.