2005.10.24 07:20 "[Tiff] How can I insert IFD at custom index?", by Шебеко Евгений

2005.10.24 20:02 "Re: [Tiff] How can I insert IFD at custom index?", by Andrey Kiselev

Eugene,

On Mon, Oct 24, 2005 at 10:20:59AM +0300, Шебеко Евгений wrote:

I need to insert IFD at a custom index.

I see only function that insert IFD at the end of file. Maybe it's possible some hack solution do do this?

You can write IFD either at the end of file (using usual method) or at the any position using the TIFFCheckpointDirectory() function. The IFD structure will be dumped out immediately whenever the TIFFCheckpointDirectory() will be called. See the attached sample code, it will create the TIFF file with the IFD in the middle of image (you can confirm that with binary viewer, just search for the DateTime tag contents).

By the way. Is TIFFWriteDirectory() check the space need for writing IFD? I beleive that if enough space in old IFD locattion TIFFWriteDirectory write it in old location. if not write it at the end of file. Is it true?

No. libtiff does not contain any memory management logic. There is a bit of such logic for image data: in update mode strips will be overwritten if they are smaller or equal of written data chunks, otherwise data will go at the end of file. Not so for directories, they always will be written at the end whenever updated.

Regards,
Andrey

PS.

Please, use latin transliteration of your name in From: field. Thanks.

--
Andrey V. Kiselev

Home phone: +7 812 5970603 ICQ# 26871517