ruven / iipsrv

iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images.
https://iipimage.sourceforge.io
GNU General Public License v3.0
292 stars 115 forks source link

Degraded quality when scaling with '^!w,h' size #273

Closed osandum closed 1 month ago

osandum commented 1 month ago

When size is specified with …/^!w,h/… we see degraded output quality in comparison to the same image specified with explicit …/w,h/….

E.g., a source image of 4,785×1,539 pixels, when rendered with …/full/^!800,800/0/default.jpg will return an 800×257 pixel JPEG, and thus we would expect the same image rendered with size explicitly set as …/full/800,257/0/default.jpg to return the same result. However, with the iipsrv-1.2 build we see degraded output when using the …/^!w,h/… format. See samples below.

…/example.tif/full/^!800,800/0/default.jpg (800×257px, 104Kb): autosize-800,800

…/example.tif/full/800,257/0/default.jpg (800×257px, 70Kb): explicit-800,257

ruven commented 1 month ago

It looks like you found a very subtle bug. When you added the ! prefix to maintain aspect ratio, the wrong resolution level was getting selected forcing an overly large resize to be carried out. I've now fixed this in https://github.com/ruven/iipsrv/commit/7743d8230f4f6db2f72bb2d0997dd69eaa17aa7b, so you should now get good output quality in both cases.

osandum commented 1 month ago

Wow, that was quick. Thank you. All is good.