2006.06.07 11:39 "[Tiff] Editing a tiff image using libtiff", by Sachin Garg

2006.06.13 07:29 "RE: [Tiff] Editing a tiff image using libtiff", by Tillaart, Rob van den

 Hi 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

This message and attachment(s) are intended solely for the use of the addressee and may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law.
If you are not the intended recipient or agent thereof responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify the sender immediately by telephone and with a "reply" message.
Thank you for your cooperation.