Page 1 of 1

Image constructor crashes when open 16 bits TIF files...

Posted: 2012-01-29T08:03:10-07:00
by spok
This is just a code to show the problem (normalyt it's 3 different files...)

Code: Select all

	Image p1("C:\\image.tif");
	::AfxMessageBox("p1 ok");

	Image p2("C:\\image.tif");
	::AfxMessageBox("p2 ok");

	Image p3("C:\\image.tif");
	::AfxMessageBox("p3 ok");
"p1 ok" is displayed always
"p2 ok" is sometimes displayed sometimes not (the program crashes when trying to construct p2)
"p3 ok" is never displayed

I have also tried to use the constructor without parameters and use read to catch an exception but no exception is thrown. The program just crashes.

Any idea ?

You can download the tif file here

Re: Image constructor crashes when open 16 bits TIF files...

Posted: 2012-01-30T04:08:18-07:00
by spok
No idea ?
Can someone please try with the tif file and tell me if it crashes too ?
Thanks.

Re: Image constructor crashes when open 16 bits TIF files...

Posted: 2012-01-30T05:27:00-07:00
by magick
We converted your TIFF image 20+ times without any problems. We're using ImageMagick 6.7.5-0 which does include a TIFF-related patch for EXIF profiles. See if 6.7.5-0 resolves your crashes.

Re: Image constructor crashes when open 16 bits TIF files...

Posted: 2012-01-30T08:13:50-07:00
by spok
magick wrote:We converted your TIFF image 20+ times without any problems. We're using ImageMagick 6.7.5-0 which does include a TIFF-related patch for EXIF profiles. See if 6.7.5-0 resolves your crashes.
OK. Thanks. I will try and let you know if it was indeed a version problem.
I'm using 6.7.3.8.

Re: Image constructor crashes when open 16 bits TIF files...

Posted: 2012-01-30T13:56:57-07:00
by spok
You were right. It works with version 6.7.5.0. Thanks.

However, I have noticed an important change in comparison with version 6.7.3.8.

I'm using 16 bits depth quantum and PixelPacket to have acces to pixel colors.
When working with jpeg or 8 bits tif, the color is stored in the low order byte of the 16 bits word.
However when working with 16 bits tif, the low order byte of the color is stored in the high order byte and vice-versa !
I had to modify my program to permute the bytes when working with 16 bits tif files.
There was no problem of that kind in 6.7.3.8.

Re: Image constructor crashes when open 16 bits TIF files...

Posted: 2012-01-30T14:46:41-07:00
by magick
If you're dealing with raw 16-bit pixels, you can set the endian to either MSB to LSB or visa versa.

Re: Image constructor crashes when open 16 bits TIF files...

Posted: 2012-01-30T15:48:15-07:00
by spok
magick wrote:If you're dealing with raw 16-bit pixels, you can send the endian to set either MSB to LSB or visa versa.
Thanks a lot !