[gdal-dev] gdal_translate to TIFF -- color mismatch
Even Rouault
even.rouault at mines-paris.org
Thu Dec 15 14:48:10 EST 2011
Le jeudi 15 décembre 2011 18:08:26, mladen-g at distributel.net a écrit :
> Hi all,
>
> I am trying to use gdal_translate to convert a .grd file
> (Northwood/VerticalMapper format) to TIFF. However, the colors in the
> translated file don't seem to be interpolated correctly based on the
> color scheme, for values near the end of the range.
>
> Here is a link to the original GRD, as well as the exported TIFFs
> (small download, only 200K):
> http://dl.dropbox.com/u/53500018/GdalQuestion.zip
>
> The GdalTranslateExport.tif file was produced with the command
> "gdal_translate -b 1 -b 2 -b 3
> C:\source\Ottawa_east_DEM30m_trim_copy.grd
> C:\temp\GdalTranslateExport.tif".
>
> Notice the top and bottom areas of the image: they are yellow. For
> comparison, take a look at the NativeExport.tif file in the same
> package. The top and bottom areas are orange, as they should be. The
> NativeExport.tif file was produced by Pitney Bowes MapInfo.
>
> Here is the color scheme for the GRD:
> http://www.smugmug.com/photos/i-bRZ879w/0/X3/i-bRZ879w-X3.jpg
>
> Notice that the thresholds are "70" for yellow, and "161" for orange.
> Well, the values at the top and bottom are in the high 130s/low 140s.
> So they should be interpolated close to orange, not yellow. Therefore
> the NativeExport.tif is correct, and the gdal_translate export is
> incorrect.
>
> I have also tried changing the thresholds, and as soon as I change the
> orange threshold to be below the maximum actual value in the GRD
> (let's say 144), the gdal_translate export shows the orange shades.
Good analysis. There was indeed a bug in the way the end of the color palette
is interpolated if the maximum z value is below a threshold of the color
scheme. See http://trac.osgeo.org/gdal/ticket/4395 for the fix (a simple typo)
>
> So, it seems there might be a bug in gdal_translate where color values
> are not interpolated correctly for thresholds that fall outside of the
> range of actual values? Or is there a way to make gdal_translate
> behave the way that I want with some different command line options?
>
> Regards,
> Mladen Gavrilovic
>
> P.S. For convenience, here is a gallery with the TIFFs converted to
> JPEG (difference is still obvious), and the color scheme:
> http://smu.gs/vMEemF
>
> P.P.S Version of GDAL is 1.8.1
>
> ----------------------------------------------------------------
> This message was sent using Distributel Webmail.
> Ce message a été envoyé à partir de la Messagerie Web Distributel.
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list