2004.03.01 20:10 "[Tiff] Hello world", by Xevit

2004.03.03 12:02 "Re: [Tiff] Hello world", by Rob van den Tillaart

My problem is that when I'm working on a big TIFF file ( tile based ) I want to read and write simultaneous to the same file, to change small portions of my bigImage.

I have never tried it, but I guess it should be possible to open the TIFF as a normal file (using open() on Unix or CreateFile() on Win32; see the code in tif_unix.c, tif_win32.c, or the appropriate file for your OS), and then pass the returned file descriptor to TIFFFdOpen(). Then you can use libtiff to read the strip offsets and sizes, and use the normal file handle to lseek() (or SetFilePointer() or whatever) to the correct offset within the file and overwrite the data there. I'm not sure whether it would be wise to use any of libtiff's write functions.

Of course, this will all only work when the TIFF is uncompressed! Otherwise, the (compressed) size of the data could change, and all bets are off.

I guess it is also possible if you only want to change the metadata/tags too, but only if you cope with them as if they are all fixed size (many of the tags are fixed size, but not all).

rob tillaart