2018.12.12 22:21 "[Tiff] Fwd: TIFFSetDirectory and TIFFCurrentDirectory issues in libtif 4.0.10", by Bardas Georgios

2018.12.12 22:21 "[Tiff] Fwd: TIFFSetDirectory and TIFFCurrentDirectory issues in libtif 4.0.10", by Bardas Georgios

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?

Currenlty i am using TIFFSetDirectory to try and get back to the previous one, but unfortunately it fails (TIFFSetDirectory(tiff,0) returns 0) after i have saved the previous' directory's data with TIFFWriteDirectory.

On the other hand, when i use TIFFCurrentDirectory on the first directory i write, strangely i get "65536" instead of 0 (probably -1 in uint), why? And when i write this folder it goes to folder 0, then 1 etc. To sum up TIFFCurrentDirectory seems to return n-1, where n is the current directory's number.

Can anyone help me?
Thanks a lot,
George.