AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2018.12.12 22:21 "[Tiff] Fwd: TIFFSetDirectory and TIFFCurrentDirectory issues in libtif 4.0.10", by Bardas Georgios
2018.12.12 22:57 "Re: [Tiff] Fwd: TIFFSetDirectory and TIFFCurrentDirectory issues in libtif 4.0.10", by Kemp Watson
2018.12.13 15:00 "Re: [Tiff] Fwd: TIFFSetDirectory and TIFFCurrentDirectory issues in libtif 4.0.10", by Olivier Paquet

2018.12.13 15:00 "Re: [Tiff] Fwd: TIFFSetDirectory and TIFFCurrentDirectory issues in libtif 4.0.10", by Olivier Paquet

Le mer. 12 déc. 2018 à 17:21, Bardas Georgios <geobar2010@gmail.com> a écrit:

Hello gentlemen,

I have been working in Libtiff for one or two weeks now, and i am stuck into some mysterious problem. I am using libtiff 4.0.10 in Visual Studio 2017 and just trying to do the following task: I am willing to fill the first page (directory) with some data (black tiles (256x256) for example) and then i need to read that information and write it on the next page decimated by two. In fact all i am trying to make is a tiled pyramid tiff image which the level 0 is so big i can parse it only through tiles. My question is: Is it possible to write one directory and then return back and read from it to write that data on the next directory?

There might be better ways but I know you can do it by opening the file a second time. After you've called TIFFWriteDirectory, use TIFFOpen() to get a second TIFF handle to read back your data and keep using your first handle to write the next image. One small caveat: windows needs (or at least used to need, I haven't checked in ages) a FlushFileBuffers() call after TIFFWriteDirectory() for this to work over SMB. I think you will also need to disable memory mapping (TIFFOpen() with "m").

Olivier