Opened 15 years ago
Closed 15 years ago
#2806 closed defect (fixed)
Converting .hgt files to 16bit PNG does not work
Reported by: | trnrez | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | 1.6.0 |
Severity: | normal | Keywords: | |
Cc: |
Description
If I use "gdal_translate -ot Int16 -of PNG infile.hgt outfile.png" I get an 8 bit grayscale image. If I use "gdal_translate -ot UInt16 -of PNG infile.hgt outfile.png " I get a 16 bit grayscale image but appears to be pure black.
Please review the FWTOOLS thread for perhaps a better explanation.
http://lists.maptools.org/pipermail/fwtools/2009-January/001474.html
If you need my help in any other way please let me know.
Thanks, Jonathan Jones
Change History (2)
comment:1 by , 15 years ago
Version: | unspecified → 1.6.0 |
---|
comment:2 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
For the first point, "-ot Int16", the result you observe is expected. The PNG driver only handles Byte and UInt16 data types, and in the other cases (silently) defaults to Byte. If you add '-strict' to the command line, you'll get an explicit error message and no conversion. But I agree that in the not strict case, a warning would be appropriate and that's what I've added in trunk in r16192.
For the second point, "-ot UInt16", I've displayed the resulting PNG with OpenEV and it looks fine. I would suspect that you use a viewer that doesn't support 16bit PNG. But 16bit PNG are an uncommon formulation of PNGs, and more generally most general-purpose image viewers don't support 16bit images. Perhaps if your aim is just to colorize the DEM as grayscale, you could use the '-scale -ot Byte' options of gdal_translate so that to remap properly the dynamics of your input data to 8bit.
So I'm closing this ticket. Please reopen if necessary.