[Geotiff] Please help unable to get height

jeff gooloolie jeffgooloolie2 at hotmail.com
Thu Mar 14 14:12:12 EST 2013


The following code retrieves the 16 bit geotiff image data, and puts it into a 8bit image for testing. The resulting 8 bit image has banding which implies that i did something wrong.     long testwidth = 2048;//output 8 bit image size
  long size = TIFFScanlineSize(tif);
  long Index,Index3;
  unsigned char* scanline = (unsigned char *) _TIFFmalloc(size);//input
  unsigned char* pimage = (unsigned char *) malloc(testwidth*testwidth*3);//output
  unsigned char Color;
  long x,y;
  for(y=0;y<testwidth;y++)
  {
   TIFFReadScanline(tif, scanline, y, 0);
   for(x=0;x<testwidth;x++)
   {
    Index3 = y*testwidth*3+x*3;
    Index  = x*2;
    //Color = ((scanline[Index+0]<<8)+scanline[Index+1])/256;
    Color = scanline[Index+0];//both the same     pimage[Index3+0] = Color;
    pimage[Index3+1] = Color;
    pimage[Index3+2] = Color;
   }
  }
Am i doing something wrong, or do i not understand something?please help!!! thanksjeff 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/geotiff/attachments/20130314/da17992f/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Image128.jpg
Type: image/jpeg
Size: 16248 bytes
Desc: not available
Url : http://lists.maptools.org/pipermail/geotiff/attachments/20130314/da17992f/attachment.jpg 


More information about the Geotiff mailing list