<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>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. <BR> <BR> <BR>  long testwidth = 2048;//output 8 bit image size<br>  long size = TIFFScanlineSize(tif);<br>  long Index,Index3;<br>  unsigned char* scanline = (unsigned char *) _TIFFmalloc(size);//input<br>  unsigned char* pimage = (unsigned char *) malloc(testwidth*testwidth*3);//output<br>  unsigned char Color;<br>  long x,y;<br>  for(y=0;y<testwidth;y++)<br>  {<br>   TIFFReadScanline(tif, scanline, y, 0);<br>   for(x=0;x<testwidth;x++)<br>   {<br>    Index3 = y*testwidth*3+x*3;<br>    Index  = x*2;<br><BR>    //Color = ((scanline[Index+0]<<8)+scanline[Index+1])/256;<br>    Color = scanline[Index+0];//both the same<BR> <BR>    pimage[Index3+0] = Color;<br>    pimage[Index3+1] = Color;<br>    pimage[Index3+2] = Color;<br>   }<br>  }<br><BR>Am i doing something wrong, or do i not understand something?<BR>please help!!!<BR> <BR>thanks<BR>jeff<BR>                                      </div></body>
</html>