2014.05.23 01:38 "Re: [Tiff] Custom EXIF write does not work for stream writer", by Chia-Kai Liang
I found the problem is that the _tiffosReadProc (in tif_stream.cxx) is not implemented (libtiff4.0.4) so TIFFFetchDirectory would fail. It seems strange as that TIFFSetDirectory is required for writing but the help function is not implemented.
In my own implementation, I try to read when the stream can be casted to iostream, which works well.
On Wed, Apr 23, 2014 at 9:56 PM, Edward Lam <email@example.com> wrote:
On Tue, April 22, 2014 22:13, Chia-Kai Liang wrote:
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
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.
Does using ostringstream instead of stringstream make a difference?