
Thread
2009.05.07 08:14 "[Tiff] [Q] TIFFReadRGBAImage (about read COMPRESSION_JPEG imagefile) of libtiff.", by masui/増井 郁久
I am japanese. my name is I.masui.
I must be good at English and forgive the thing that cannot be written.
It is a question on TIFFReadRGBAImage (about read COMPRESSION_JPEG imagefile) of libtiff.
======= (*Quotation http://www.libtiff.org/libtiff.html) =======
#include "tiffio.h"
main(int argc, char* argv[])
{
TIFF* tif = TIFFOpen(argv[1], "r");
if (tif) {
uint32 w, h;
size_t npixels;
uint32* raster;
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
npixels = w * h;
raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));
if (raster != NULL) {
if (TIFFReadRGBAImage(tif, w, h, raster, 0)) {
// OK(when COMPRESSION_CCITTFAX4).
}
else {
// error (when COMPRESSION_JPEG)
<<<<<<<<
}
_TIFFfree(raster);
}
TIFFClose(tif);
}
exit(0);
}
(note. COMPRESSION_CCITTFAX4,COMPRESSION_JPEG is got by
"uint16 compress; TIFFGetField(m_tif,
TIFFTAG_COMPRESSION, &compress);"
======================================================================
It becomes an error by "TIFFReadRGBAImage" at "COMPRESSION_JPEG"-ImageFile(TIFF) though it is possible to read at "COMPRESSION_CCITTFAX4"-ImageFile(TIFF) by the above-mentioned reading method.
How can I read at COMPRESSION_JPEG? <<<<<<<<
<end>