2005.10.17 03:43 "[Tiff] newbie asks for help with mingw and libtiff", by

2005.10.26 14:43 "Re: [Tiff] Re: checking test images", by Frank Warmerdam

On 10/26/05, ryuki_dono <ryuki_dono@yahoo.de> wrote:

It was not meant as an insult. I used JPEG.lib and PNG.lib before and they where able to provide the full support of the image format with high level functions.

Ryuki,

With all due respect, libjpeg and libpng do not attempt to support the same breadth of image data types as libtiff. I would add that I am not aware of a "convert to RGB/RGBA" interface in libpng (though it might exist), and libjpeg cannot even support 12 bit jpeg files unless it is built a special way (in which case it cannot support 8bit files).

I, for one, have avoided trying to implement support in the RGBA interface for higher bit depth images because in my industry (geospatial), just shifting off the low order bits to make the image 8bit is not the appropriate response to high dynamic range data. Many remote sensing sensors produce odd dynamic ranges and more sophisticated strategies are called for.

I had to check the support informations more. I only wondered why there is no 24 and 32 bit support yet? Since TIFFReadRGBAImage provides 4x8Bit output there should be no problem with that.

But I don't feel comfortable hacking the support into the library functions.

Neither do I, ironically.

static void MyRobErrorHandler(const char* module, const char* fmt,
va_list ap)
{
    throw "Error";
    // CString message;
   // throw message.Format(fmt,ap);
}

I would like to stress very strongly that it is not safe, at the very least not clean, to throw an exception from within the error handler. Libtiff assumes that control will return to the calling function so that it can cleanup appropriately after the error. Your approach should only be used in cases where memory leaks and other possible corruption on failure are not a significant concern.

A more appropriate solution would be to check the return values of important functions such as TIFFReadRGBAImage().

Best regards,
--

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent