| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2006.06.13 07:29 "Re: Editing a tiff image using libtiff", by Rob Van Den TillaartHi Sachin, Joris, > > Appending is a good option, but will waste space and it does changes > > the order of blocks/tags. > > You are correct about the space waste. That's the trade-off. > Either you rewrite a complete file, or you sacrifice space in the > existing file. > > OT: Things could have been different if TIFF had a memory-manager > scheme in it. <thought experiment mode> If space waste is an issue one could introduce a micro-memory manager (MMM). Suppopse one wants to update a strip/tile, the traditional scenario is: 1) the strip is loaded and decompressed in memory. 2) the strip is edited 3) the strip is compressed again 4) the strip is stored at the end of the TIFF file 5) and tags are updated An MMM would interact just before step 4. It looks at the size of the new strip and compares it to the previous size If (strip fits) reuse() Else append() On average there is a 50% chance (depends on type of editing) the new strip will fit, so on average the filesize will grow less fast. An additional way to handle space is the introduction of an 'alloc-tag'. This tag indicates the size of the 'allocated' block in the file in contrast to the size tag which indicates the count of the bytes used. The MMM described above can make a better decission when to reuse the existing strip space if these 'alloc-tags' would be in the file. Note that if these 'alloc-tags' would be removed TIFF would work just as we know. Drawback of the 'alloc-tags' is of course the space they cost :) </thought experiment mode> So far my two cents, Regards, Rob tillaart |
|||||||