2010.05.24 17:36 "[Tiff] Script to resample large TIFFs", by Richard Nolde
2. Script Oriented, File Based Utility for Resampling TIFF Files
(Kevin Myers)From: "Kevin Myers"<firstname.lastname@example.org>
Subject: [Tiff] Script Oriented, File Based Utility for Resampling
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
I am working with a large number (thousands) of extremely large tiff images (hundreds of megapixels or larger) that need to be resampled, most of them from 300 dpi to 200 dpi. Currently I am using GraphicsMagick for this purpose GraphicsMagick is an excellent program, but it is very slow for the images that I am dealing with due to their size and GraphicsMagick's memory-oriented implementation (it essentially wants to load the entire image into memory at one time, since the image won't fit into RAM in the representation used by GraphicsMagick, it is paged to and from disk, which is very slow).
In order to speed up this process, I need a script oriented resampling utility that can only load portions of images (e.g tiles or strips) into memory at one time, something similar to tiffcp. Both tiffcp and its cousin tiffcrop can manipulate tiff images without loading the entire image into memory, but neither is capable of true resampling to my knowledge. Does anyone know of a script (command line) oriented strip/tile based re-sampling utility for tiff files?
While tiffcrop does not yet support re-sampling, you may be able to use tiffcrop to produce a series of smaller images representing portions of the original image, and write them to a single output file or a series of files depending on which export option you select, and then resample them with Graphics Magick or any program you like. At that point, you would need a utility to paste the re-sampled images back into a single file. Tiffcrop is not yet capable of doing this, but it would not be hard to add that option if you want to contribute that code. All the logic to paste multiple selections into the output buffer already exist. GraphicsMagick may already have the ability to create a single output image from a series of input images.
Alternately, if you want to contribute code to resample the data, I can probably add that to tiffcrop. Tiffcrop currently reads a Tile or Strip at at time from the input image and loads the entire image into memory. It sounds like you might need a special mode to read and process a strip at a time as well. I don't remember the format of your images (well drilling logs?) and what limitations might be imposed by their format. You might send me the output from tiffinfo and/or tiffdump to see if that is an issue.