
Thread
2009.02.13 03:24 "[Tiff] TIFFReadRGBAImage w/ 8bit-gray + aplha", by Chris Losinger
i have a TIFF: 8-bit grayscale w 8-bit alpha which i'm trying to read it with TIFFReadRGBAImage. unfortunately, i get an access violation inside the 'putgreytile' function.
i don't know if the problem is common to all gray+alpha images or just this one, so here's a link to the image i'm testing with:
http://www.smalleranimals.com/images/8gray_alpha.tif
(warning, it's 3.55MB)
i've tested with a clean copy of LibTiff v3.7.1, using the code below, and my own slightly tweaked version of v3.8.2 - same crash.
any ideas?
-c
--------------
int
main(int argc, char* argv[])
{
uint32* raster;
uint32 width, height;
uint32 row;
TIFF *in;
in = TIFFOpen(argv[1], "r");
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);
raster = (uint32*)_TIFFmalloc(width * height * sizeof (uint32));
if (raster == 0) {
TIFFError(TIFFFileName(in), "No space for raster buffer");
return (0);
}
if (!TIFFReadRGBAImageOriented(in, width, height, raster,
ORIENTATION_TOPLEFT,
0)) {
_TIFFfree(raster);
return (0);
}
_TIFFfree( raster );
(void) TIFFClose(in);
return 0;
}
----
Chris Losinger
losinger@earthlink.net
smallest@smalleranimals.com http://www.smalleranimals.com