AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
June 2006

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2006.06.07 11:39 "Editing a tiff image using libtiff", by Sachin Garg
2006.06.07 12:51 "Re: Editing a tiff image using libtiff", by Joris Van Damme
2006.06.12 13:59 "Re: Editing a tiff image using libtiff", by Sachin Garg
2006.06.12 15:09 "Re: Editing a tiff image using libtiff", by Joris Van Damme
2006.06.13 07:29 "Re: Editing a tiff image using libtiff", by Rob Van Den Tillaart
2006.06.13 08:32 "Re: Editing a tiff image using libtiff", by Gerben Vos
2006.06.13 08:55 "Re: Editing a tiff image using libtiff", by Rob Van Den Tillaart
2006.06.13 16:04 "Re: Editing a tiff image using libtiff", by Joris Van Damme
2006.06.13 16:02 "Re: Editing a tiff image using libtiff", by Joris Van Damme
2006.06.14 09:08 "Re: Editing a tiff image using libtiff", by Gerben Vos

2006.06.13 07:29 "Re: Editing a tiff image using libtiff", by Rob Van Den Tillaart

 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