browserdeepzoomgammaopenseadragon

Gamma-correct zoomable image (dzi, etc) generator


I'm using MS Deep Zoom Composer to generate tiled image sets for megapixel sized images.

Right now I'm preparing a densely detailed black and white linedrawing. The lack of gamma correction during resizing is very apparent; while zooming the tiles appear to become brighter on higher zoom levels. This makes the boundaries between tiles quite apparent during the loading stage.

While it does not in any way hurt usability it is a bit unsightly. I am wondering if there are any alternatives to Deep Zoom Composer that do gamma correct resizing?


Solution

  • The vips deepzoom creator can do this.

    You make a deepzoom pyramid like this:

    vips dzsave somefile.tif pyr_name
    

    and it'll read somefile.tif and write pyr_name.dzi and pyr_name_files, a folder containing the tiles. You can use a .zip extension to the pyramid name and it'll directly write an uncompressed zip file containing the whole pyramid --- this is a lot faster on Windows. There's a blog post with some more examples and explanation.

    To make it shrink gamma corrected, you need to move your image to a linear colourspace for saving. The simplest is probably scRGB, that is, sRGB with linear light. You can do this with:

    vips colourspace somefile.tif x.tif scrgb
    

    and it'll write x.tif, an scRGB float tiff.

    You can run the two operations in a single command by using .dz as the output file suffix. This will send the output of the colourspace transform to the deepzoom writer for saving. The deepzoom writer will use .jpg to save each tile, the jpeg writer knows that jpeg files can only be RGB, so it'll automatically turn the scRGB tiles back into plain sRGB for saving.

    Put that all together and you need:

    vips colourspace somefile.tif mypyr.dz scrgb
    

    And that should build a pyramid with a linear-light shrink.

    You can pass options to the deepzoom saver in square brackets after the filename, for example:

    vips colourspace somefile.tif mypyr.dz[container=zip] scrgb
    

    The blog post has the details.

    update: the Windows binary is here, to save you hunting. Unzip somewhere, and vips.exe is in the /bin folder.