2003.09.01 11:49 "[Tiff] Reading and writing to memory.", by Väinö Järvelä
My software has to manipulate some very large TIFF images. The images are so big that they won't fit in the memory uncompressed, so i need to have the images compressed in the memory and uncompress it strip at a time, manipulate and compress back to the memory. When the manipulations are complete, then write it to a file.
I know i could pump up the swap space, but it might be faster to do it all in memory even with all this uncompressing and compressing than writing and reading gigabytes of data from and to swap(done automatically by kernel ofcourse) and work from there.
I have tried using TIFFClientOpen by creating my own read,write,seek,size procs which pass a struct (through thandle_t) to the functions and manipulate the data(image buffer) in the struct. But when i try to "open" the memory with
Tiff = TIFFClientOpen( "dummy", "w", (thandle_t) &mt, tiffMemReadProc,
tiffMemWriteProc, tiffMemSeekProc, tiffMemCloseProc, tiffMemSizeProc,
NULL, NULL );
It fails by saying: "dummy: Not a TIFF file, bad magic number 0 (0x0)."
I don't undestand this error message.. i'm not trying to read or append (to) an old TIFF file, but it apparently still tries to read one?
Is there anything specific i have to do in those procs? Return a specific value on the first run or something?
Is mmap and unmap procs mandatory?