2014.04.23 02:13 "[Tiff] Custom EXIF write does not work for stream writer", by Chia-Kai Liang

2014.04.23 02:13 "[Tiff] Custom EXIF write does not work for stream writer", by Chia-Kai Liang

Hi all

I tried to use the EXIF directory read/write as described in http://www.asmail.be/msg0055060707.html, and find it would fail for stringstream

If I replace

   tif = TIFFOpen(filename, "w+");

in the example code to

    std::stringstream buf_stream;

    tif = TIFFStreamOpen("MemTIFF", (std::ostream*)&buf_stream);

I would get the following error at TIFFSetDirectory(tif, 0):

TIFFFetchDirectory: MemTIFF: Can not read TIFF directory count. TIFFReadDirectory: Failed to read directory at offset 22688648.

All other libTiff functionality works fine. I can dump the stringstream to a file and open it in Photoshop, as long as I don't embed EXIF (or call TIFFSetDirectory, which is required for EXIF embedding).

Is this expected or can be fixed easily?

Chia-Kai Liang