AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2010.05.08 18:39 "[Tiff] Merge several TIFFG4 images", by Oliver Geisen
2010.05.10 11:40 "Re: [Tiff] Tiff Digest, Vol 72, Issue 4", by Weichao Wang
2010.05.10 04:04 "[Tiff] Merging multiple Group4 compressed TIFF files", by Richard Nolde
2010.06.22 19:29 "Re: [Tiff] Tiff Digest, Vol 73, Issue 14", by Morgenstern, James

2010.05.10 04:04 "[Tiff] Merging multiple Group4 compressed TIFF files", by Richard Nolde

1. Merge several TIFFG4 images (Oliver Geisen)

i need to write a tool using libtiff which is able to paste 1 to 10 G4 compressed bilevel TIFF images onto a large (17300x27051 pixel) image and save this as G4 compressed image also. The images to be pasted onto the canvas are different in size, but much smaller.

You aren't clear about the sizes of your input images and the desired arrangment of them in the output image. You might look at some of the export options available in Tiffcrop to see if they will meet your need, eg -e combined will merge multiple input selections into one output image if the selections are from the same input image with some restrictions. To merge vertically, the width of the selections must match, to merge horizontally, the length of the selections must match. I doubt that this is what you are describing however. To merge multiple selections of different sizes to different locations in a single output image, you are going to have to calculate all the offsets ahead of time and do some significant memory management and/or disk thrashing as the entire width of the image will have to be in memory before you can write out any one scanline unless you build it up in multiple passes adding one image each time.

All the issues of bit shifting that you describe are handled in tiffcrop. You might consider contributing to tiffcrop rather than reinventing the wheel. Other list members might have additional ideas.

Richard

Now i wonder if it is best to create the big image in memory and write the data of each image to be placed in turn into this memory block, or process it line by line.

Libtiff itself seems not to provide any image functions itself, but it is the only lib i found which can handle G4 TIFFs natively without converting it into an internal colorspace (which makes them impossible to handle because they grow to several GB in memory). What i need is some advice how to start this. One big problem for me is bit-shifting. If an image to be placed does not start on a byte boundary, i need to shift all pixels (bits) of a row, line by line. This may take a long time and i really don't know how to code this efficiently in C.

The tool must be very very fast, so i merging does not take longer than several seconds.

Any help is appreciated here!

> ------------------------------

> Tiff mailing list

> End of Tiff Digest, Vol 72, Issue 4
> ***********************************

>
>