<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>&nbsp;<BR>&nbsp;<BR>&nbsp;&nbsp;long testwidth = 2048;//output 8 bit image size<br>&nbsp;&nbsp;long size = TIFFScanlineSize(tif);<br>&nbsp;&nbsp;long Index,Index3;<br>&nbsp;&nbsp;unsigned char* scanline = (unsigned char *) _TIFFmalloc(size);//input<br>&nbsp;&nbsp;unsigned char* pimage = (unsigned char *) malloc(testwidth*testwidth*3);//output<br>&nbsp;&nbsp;unsigned char Color;<br>&nbsp;&nbsp;long x,y;<br>&nbsp;&nbsp;for(y=0;y&lt;testwidth;y++)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;TIFFReadScanline(tif, scanline, y, 0);<br>&nbsp;&nbsp;&nbsp;for(x=0;x&lt;testwidth;x++)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;Index3 = y*testwidth*3+x*3;<br>&nbsp;&nbsp;&nbsp;&nbsp;Index&nbsp; = x*2;<br><BR>&nbsp;&nbsp;&nbsp;&nbsp;//Color = ((scanline[Index+0]&lt;&lt;8)+scanline[Index+1])/256;<br>&nbsp;&nbsp;&nbsp;&nbsp;Color = scanline[Index+0];//both the same<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;pimage[Index3+0] = Color;<br>&nbsp;&nbsp;&nbsp;&nbsp;pimage[Index3+1] = Color;<br>&nbsp;&nbsp;&nbsp;&nbsp;pimage[Index3+2] = Color;<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;}<br><BR>Am i doing something wrong, or do i not understand something?<BR>please help!!!<BR>&nbsp;<BR>thanks<BR>jeff<BR>                                               </div></body>
</html>