2008.04.22 11:18 "RE: [Tiff] Interleaving images from multiple Tiff files", by Andrew Wan

2008.04.22 11:18 "RE: [Tiff] Interleaving images from multiple Tiff files", by Andrew Wan

Hi Richard

I was thinking to use the C system call to call tiffsplit & tiffcp. But ofcourse I need to use TIFFReadDirectory to find out how many tiff images are in tiff1.tif & tiff2.tif, and they should match in size (eg. 10 images in tiff1.tif and 10 images in tiff2.tif).

Then somehow create an empty tiff file called output.tif and then run this 2-liner in a loop:

for (int i=0; i<size; i++) {
  system("copy output.tif temp.tif");
  system("tiffcp temp.tif tif1.tif,i tif2.tif,i output.tif");//ofcourse use sprint or something to set i

(according to http://www.libtiff.org/man/tiffcp.1.html)

Do you think this will work?

What is the fastest way to build tiffcp & tiffsplit? Is it necessary to have built

..\port\libport.lib ..\libtiff\libtiff.lib?


> Date: Fri, 28 Dec 2007 10:30:39 -0700> From: Richard Nolde <nrichard8@qwest.net>> Subject: [Tiff] Interleaving images from multiple Tiff files> To: tiff@lists.maptools.org> Message-ID: <477532BF.5020203@qwest.net>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed> > Andrew,> Two solutions come to mind. A very inefficient way to do this would be > to use tiffsplit to break each input file into separate output files and > then tiffcp to put them back together in a different order.> > If you want to do this on a regular basis, look at tiffcp and modify the > logic that reads files sequentially to read them in parallel. This will > require you to rewrite the main function to use multiple file handles, > one for each input file given as a parameter, and one for the single > output file. Loop through your reads one input file at at time, writing > each image to a single output file in sequence. You will have to > maintain separate indices for the read image and the write image, but > that should not be too hard. Of course, this assume that you are using > all the input images. You could select individual images from the input > image with the current logic in tiffcp if you always want the same > sequence from each input file. If you want to select independently from > each input file, build a list structure for each one and modify the > parser to associate each list with a specific input file.

Express yourself wherever you are. Mobilize!