2010.05.08 18:39 "[Tiff] Merge several TIFFG4 images", by 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. 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!