Re: [gdal-dev] gdal_translate to TIFF -- color mismatch

2011-12-15 Thread Even Rouault
Le jeudi 15 décembre 2011 18:08:26, mlade...@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@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] gdal_translate to TIFF -- color mismatch

2011-12-15 Thread mladen-g

Wow, that was fast.  Thanks!

I see that the fix is in 1.8.2... Do you know will this be a separate  
release or will the fixes be merged into 1.9.0?  I ask because I see  
some recent discussions suggesting that 1.9.0 may be released by the  
end of the year.


Thanks again for the quick response,
Mladen


Quoting Even Rouault even.roua...@mines-paris.org:


Le jeudi 15 décembre 2011 18:08:26, mlade...@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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev







This message was sent using Distributel Webmail.
Ce message a été envoyé à partir de la Messagerie Web Distributel.


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] gdal_translate to TIFF -- color mismatch

2011-12-15 Thread Even Rouault
Le jeudi 15 décembre 2011 23:32:14, mlade...@distributel.net a écrit :
 Wow, that was fast.  Thanks!
 
 I see that the fix is in 1.8.2... Do you know will this be a separate
 release or will the fixes be merged into 1.9.0?  I ask because I see
 some recent discussions suggesting that 1.9.0 may be released by the
 end of the year.

The fix also went to trunk (1.9.0) of course (*). And 1.9.0 will likely be 
released before 1.8.2 indeed.

(*) Trac has no way to specify multiple target milestones, so I tend to 
indicate the milestone corresponding to the stable branch if it has been 
applied there too. The general rule being that all fixes that go to the stable 
branch go to trunk too.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev