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. Like this:<br><br> int nColorCount, nMaxColor = 0;<br> GDALColorEntry oEntry;<br><br> poColorTable = new GDALColorTable();
<br><br> nColorCount = 1 << nBitsPerSample;<br><br> for( int iColor = nColorCount - 1; iColor >= 0; iColor-- )<br> {<br> oEntry.c1 = panRed[iColor] / 256;<br> oEntry.c2 = panGreen[iColor] / 256;
<br> oEntry.c3 = panBlue[iColor] / 256;<br> oEntry.c4 = 255;<br><br> poColorTable->SetColorEntry( iColor, &oEntry );<br><br> nMaxColor = MAX(nMaxColor,panRed[iColor]);<br>
nMaxColor = MAX(nMaxColor,panGreen[iColor]<div style="direction: ltr;">);<br> nMaxColor = MAX(nMaxColor,panBlue[iColor]);<br> }<br><br> // Bug 1384 - Some TIFF files are generated with color map entry
<br> // values in range 0-255 instead of 0-65535 - try to handle these<br> // gracefully.<br> if( nMaxColor > 0 && nMaxColor < 256 )<br> {<br> CPLDebug( "GTiff", "TIFF ColorTable seems to be improperly scaled,
<br>fixing up." );<br><br> for( int iColor = nColorCount - 1; iColor >= 0; iColor-- )<br> {<br> oEntry.c1 = panRed[iColor];<br> oEntry.c2 = panGreen[iColor];<br>
oEntry.c3 = panBlue[iColor];<br> oEntry.c4 = 255;<br><br> poColorTable->SetColorEntry( iColor, &oEntry );<br> }<br> }<br><br>The problem file has been archived in data/geotiff/misc as:
<br><br> 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't see this fix in this code. 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? <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>