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

fails on file processed with vips, but works if png used as intermediary #254

Open andrisi opened 1 year ago

andrisi commented 1 year ago

I have lots of TIFF files, which are not served correctly by IIPSRV if they are turned into multilayer ones with vips using the command line below. The tiles returned are invalid according to Chrome, Windows Picasa, etv.. If I save the file to PNG, and then to multilayer TIFF, they work fine. If you're interested I can provide the files.

vips tiffsave X2.raw X2.tiff --vips-progress --tile --pyramid --compression deflate --tile-width 256 --tile-height 256

On conversion to PNG with

vips pngsave A1.tiff X2.png --vips-progress

I get this below, but upon converting the PNG to TIFF, serving from IIPSRV works fine:

(vips:643988): VIPS-WARNING **: 21:47:15.724: profile 'icc': 0h: PCS illuminant is not D50
(vips:643988): VIPS-WARNING **: 21:47:15.724: bad ICC profile not saved
ruven commented 1 year ago

It's probably an invalid ICC profile which causes Chrome to reject it. When you first save as PNG, the profile gets stripped, which is why converting from PNG to TIFF works. Anyway, please send me an example file and I'll take a closer look.

andrisi commented 1 year ago

You mean you send the TIFF file's ICC profile with every tile? Sorry, I'm not that much into the details of TIFF format and to find out where/what fails, but thanks a lot for getting back to me.

ruven commented 1 year ago

Thanks I've got the image.

ICC profiles are added by default to the tiles so that the browser knows how to correctly display the colors. There is an iipsrv environment parameter: EMBED_ICC, which you can set to 0 if you don't want any profiles added.

However, in your particular case, the profile is very large, so iipsrv strips it out anyway. And the image works fine for me after conversion using the vips command you posted earlier. Which version of iipsrv are you using exactly? 1.1 or the latest code from Github? If you are trying to view the tiles in PNG format, I just committed a fix to a potential bug, so maybe this will help. And can you post the lines from the iipsrv log file when an error occurs?

andrisi commented 1 year ago

Thanks! I used the one from the Ubuntu 22 repository, will check.

ruven commented 1 year ago

OK, it's iipsrv version 1.1 in the Ubuntu repository. There's in fact a bug in that version when you have very large ICC profiles. So, just set EMBED_ICC to 0 and it should work fine. This is now, in any case, fixed if you use the latest code.