libtiff problem with TIFFReadRGBAImage

libtiff problem with TIFFReadRGBAImage

Post by Eri » Fri, 08 Aug 2003 03:44:29



I am getting a seg fault when I call TIFFReadRGBAImage on large 1bit
tiffs 30,000x30,000 but it runs fine on small color ones.  A trace of
the seg fault is:
put1bitbwtile
gtStripContig
TIFFRGBAImageGet
TIFFReadRGBAImage
Then my functions.
Has anyone had this problem before?  I am using version 3.5.7 in
Win2000.  Here is sample of my code.

wxString TiffGLCanvas::loadTiff(const wxString& filename){
    // load tiff
    TIFF *tiff = TIFFOpen(filename.c_str(), "r");
    if(!tiff) return(wxT("Error")); // couldn't open
    unsigned int w, h;
    unsigned int* raster;
    TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
    TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
    raster = (unsigned int*)_TIFFmalloc(w*h*sizeof(unsigned int));
    int error = TIFFReadRGBAImage(tiff, w, h, (uint32*)raster, 0);
    TIFFClose(tiff);

    // save tiff information
    tiffs.setTiff(0, filename, raster, w, h);
    wxString msg;
    msg.Printf(wxT("Loaded w %u h %u error %d"),
        w, h, error);
    return(msg);

Quote:}