AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2004.06.08 00:23 "[Tiff] Libtiff for embedded.", by
2004.06.08 06:32 "Re: [Tiff] Libtiff for embedded.", by Andrey Kiselev
2004.06.08 14:45 "RE: [Tiff] Libtiff for embedded.", by Rajanikanth T

2004.06.08 14:45 "RE: [Tiff] Libtiff for embedded.", by Rajanikanth T

Hi,

I tried using mfs_open() call to open memory file. but i am getting segmentation fault at _malloc_unlocked()

can u tell me what wrong with this code?

   fd = mfs_open (tiff_image,311226,"r"); /*tiff_image containes image data of size 311226*/
   tiffin = TIFFFdOpen(fd,"test" , "r");   /* test is dummy name*/

  TIFFGetField(tiffin, TIFFTAG_IMAGEWIDTH, &width);   /*get tif image width */
  TIFFGetField(tiffin, TIFFTAG_IMAGELENGTH, &height); /*get tif image height */

  npixels = width * height;
  raster = (uint32*) _TIFFmalloc(npixels*sizeof(uint32));
  buf = matrixCalloc (height, width);/* allocate memory */

  if (raster != NULL)
    {
    if (TIFFReadRGBAImage(tiffin, width, height, raster, 0)) /*8 bit image*/
      {
      for (i=0; i<height; i++)
        {
        for (j=0; j<width; j++)
          {
          buf[(height-1)-i][j] = TIFFGetR(raster[i*width+j]);
          }
        }
      }
    }

  TIFFClose(tiffin);

Thanks and regards,

-----------------------------------------------
Rajanikanth T
KnS, HCL Technologies
Bangalore.
Contact No: 098860 68983
Office No   : 080-51197748 Ext: 4137
http://hellorajni.8m.com
-----------------------------------------------