Hi,<br><br><br>I have already tried to use gdal by downloading FWTools
updated with
beta2 and a problem I experienced with previous gdal version is still
there(pls. see below description of original problem).<br><br>ORIGINAL PROBLEM: running gdal_merge.py -pct -o 
output.tif -pct in1.tif in2.tif where in*tif = geotiff images with one band and same color table, gave me a full black out.tif.<br>This was reported as a bug and it was fixed according to bugzilla report for 1.4.0beta2.<br>



<br>You can find the input images here if you would like to give it a try:<br><a href="http://www.mediamax.com/izzybitsie/Hosted/AS_GMSSO_00_20061122205634.tif" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">


http://www.mediamax.com/izzybitsie/Hosted/AS_GMSSO_00_20061122205634.tif
</a><span><br><span></span><a href="http://www.mediamax.com/izzybitsie/Hosted/AS_GMSNO_00_20061122205548.tif.gz" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.mediamax.com/izzybitsie/Hosted/AS_GMSNO_00_20061122205548.tif.gz
</a><br><br><br><br><br>BUGZILLA REPORT<br><br></span>

Updated colortable reading to look guess about the scaling problem, and<br>fix up on the fly if encountered. &nbsp;Like this:<br><br> &nbsp; &nbsp; &nbsp; &nbsp;int &nbsp; &nbsp; nColorCount, nMaxColor = 0;<br> &nbsp; &nbsp; &nbsp; &nbsp;GDALColorEntry oEntry;<br><br> &nbsp; &nbsp; &nbsp; &nbsp;poColorTable = new GDALColorTable();
<br><br> &nbsp; &nbsp; &nbsp; &nbsp;nColorCount = 1 &lt;&lt; nBitsPerSample;<br><br> &nbsp; &nbsp; &nbsp; &nbsp;for( int iColor = nColorCount - 1; iColor &gt;= 0; iColor-- )<br> &nbsp; &nbsp; &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oEntry.c1 = panRed[iColor] / 256;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oEntry.c2 = panGreen[iColor] / 256;
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oEntry.c3 = panBlue[iColor] / 256;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oEntry.c4 = 255;<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;poColorTable-&gt;SetColorEntry( iColor, &amp;oEntry );<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nMaxColor = MAX(nMaxColor,panRed[iColor]);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nMaxColor = MAX(nMaxColor,panGreen[iColor]<div style="direction: ltr;">);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nMaxColor = MAX(nMaxColor,panBlue[iColor]);<br> &nbsp; &nbsp; &nbsp; &nbsp;}<br><br> &nbsp; &nbsp; &nbsp; &nbsp;// Bug 1384 - Some TIFF files are generated with color map entry
<br> &nbsp; &nbsp; &nbsp; &nbsp;// values in range 0-255 instead of 0-65535 - try to handle these<br> &nbsp; &nbsp; &nbsp; &nbsp;// gracefully.<br> &nbsp; &nbsp; &nbsp; &nbsp;if( nMaxColor &gt; 0 &amp;&amp; nMaxColor &lt; 256 )<br> &nbsp; &nbsp; &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CPLDebug( &quot;GTiff&quot;, &quot;TIFF ColorTable seems to be improperly scaled,
<br>fixing up.&quot; );<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for( int iColor = nColorCount - 1; iColor &gt;= 0; iColor-- )<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oEntry.c1 = panRed[iColor];<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oEntry.c2 = panGreen[iColor];<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oEntry.c3 = panBlue[iColor];<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oEntry.c4 = 255;<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;poColorTable-&gt;SetColorEntry( iColor, &amp;oEntry );<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br> &nbsp; &nbsp; &nbsp; &nbsp;}<br><br>The problem file has been archived in data/geotiff/misc as:
<br><br> &nbsp; Bug1384_8bit_colortable.tif</div><br><br>

=====================================================================<br><br><br>I checked geotiff.cpp downloaded with gdal1.4.0beta2 that includes code that looks like the one above, but I don&#39;t see this fix in this code.&nbsp; Am I looking at the wrong code?
<br><br><span>Does anyone know if fix for this bug was really included in FWTools1.1.2?&nbsp; <br>If so, does anyone have
an idea on why I am still getting a black output image?  <br>Is there any other way to compose these 2 images keeping the color table?<br></span><br><br>BIG TX<br>