2014.06.17 09:46 "[Tiff] In-memory tiffs", by Benedikt_Führer

2014.06.17 09:46 "[Tiff] In-memory tiffs", by Benedikt_Führer

Hey,

I have to questions regarding in-memory tiffs:

  1. I'm using the helper functions TIFFStreamOpen to try to write multi-directory tiffs into an ostringstream in binary mode. It works perfectly fine for the first directory but as soon as I call TIFFWriteDirectory the 2nd time, it will fail with the error message "Couldn't fetch directory count". What am I doing wrong here? I suspected that the library tries to read information from the stream which seems to fail but I constructed to ostringstream with support for input operations and am otherwise using the tiff handle in the exact same way as it was a std file (in that case it works perfectly fine). I'm not bound to an ostringstream if that's what causes the problems but it seemed like the easiest way to get the in-memoy byte representation of a tiff which is my ultimate goal.
  2. Because of this problem I tried to debug the tiff source from within my VStudio project. I'm linking libtiff statically, so it's added in the linker input field and the include directory is known to the compiler. However it won't allow me to step into the source files even if I enter the libtiff directory as a directory to look for debug sources (and I'm sure the sources don't differ from the ones compiled into the lib). But I don't get why that should even be necessary. I also tried to link it dynamically. Works fine in general but now I get unresolved externals on the helper functions TIFFStreamOpen. I then added tiff_stream.cxx with the definitions to my project using libtiff so that it gets compiled. Works again but then MSVC told me it couldn't write the manifest file to it's location because of a wrong parameter. This is fixed by a complete project rebuild and everything builds and is linked then. The console even says that the debug symbols of libtiff are loaded but I can't run the program then because MSVCR80.dll is missing although it's included in the MSVC8 runtime. Really weird - seems like a x64/x86 conflict but I was building libtiff from the MSVC x64 command line and my project is also built as x64.
  3. Would love if someone could help me with that.

Best regards