2005.01.25 18:29 "[Tiff] issues with TIFFStreamOpen", by Michael Rinne

2005.01.28 16:45 "Re: [Tiff] issues with TIFFStreamOpen", by Michael Rinne

Hi Edward,

I've logged this issue as a minor bug under #756.

thanks, I have not been aware of bugzilla for libTIFF before.

How does anyone expect to treat streams generically? <sigh> We could do

I totally agree with that. ;-(

Not to mention the fact that in gcc 2.96, we had to do ugly hacks so that we could seek using ostrstream's. :( We've debated here before whether we should just give up on iostreams completely because we've been bitten by poor implementations so many times. We've seen cases where streaming a buffer would cause a memory reallocation every *single* character!

Sounds like you are talking about the ostringstream implementation in MS VC 6.0 SP*. We have a workaround in our software, which assigns a string of the expected size to the ostringstream before writing a large amount of characters. M$ fixed the implementation of ostringstream in MS VC 7.1. However, such a workaround is nothing one can do in a library which gets called with an object casted to the base class ostream.

With this fix I get a valid TIFF image with the correct size and color depth, but unfortunately it is all black.

I patched this to

140:    // extend the stream to the expected size
141:    os->seekp(0, ios::end);
142:    num_fill = origin + off - (toff_t)os->tellp();

which resulted in a valid TIFF file with my test image.

Excellent! Sorry about the obvious bug. It explains why you get a black image doesn't it? :) I don't see anything else wrong with the file now, shall we submit your latest version of tif_stream.cxx to bugzilla?

That would be great! Can you do it? You seem to be more familiar with the libTIFF development and you made most of the changes in that file.

Thanks,
Michael