Ticket #4185 (closed defect: invalid)

Opened 22 months ago

Last modified 22 months ago

some problem with gdal_translate jpeg 12bits

Reported by: tunofilho Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: 1.8.0
Severity: normal Keywords: gdal_translate
Cc:

Description

hi, I was using gdal_translate in qgis 1.7.0 and I was looking for how to transform a raster of srtm raster .tif to srtm raster .jpeg 12bits, but there is a problem in modification of libjpeg to 12 bits. The transformation didn't obey the change of scale 16bits to 12bits, in other words, value of pixels over 4095 in 16 bits have been cut to value 4095 in 12bits. The correct would be adjust scale 16bits to 12bits. In algorithm of jpeg, the matrix 8x8 must be subtract by 128(8bits) or 2048(12bits). In attach there is a light of signal of srtm raster .tif and .jpeg (gdal_translate).

Attachments

line of sight tif srtm2317 Download (33.0 KB) - added by tunofilho 22 months ago.
line of sight jpeg srtm2317 Download (28.8 KB) - added by tunofilho 22 months ago.

Change History

Changed 22 months ago by tunofilho

Changed 22 months ago by tunofilho

follow-up: ↓ 2   Changed 22 months ago by rouault

  • status changed from new to closed
  • resolution set to invalid

Scaling is never implicit. You should explicitely ask for it with the -scale option of gdal_translate. There's no way that gdal_translate can guess reliably how you want to rescale your data.

You should also have seen a warning when translating values about 4095 :

One or more pixels clipped to fit 12bit domain for jpeg output.

in reply to: ↑ 1   Changed 22 months ago by tunofilho

  • status changed from closed to reopened
  • resolution invalid deleted

Replying to rouault:

Scaling is never implicit. You should explicitely ask for it with the -scale option of gdal_translate. There's no way that gdal_translate can guess reliably how you want to rescale your data. You should also have seen a warning when translating values about 4095 : {{{ One or more pixels clipped to fit 12bit domain for jpeg output. }}}

thanks for the fast answer.. but I put the option "-scale = [0 65535[0 4095]] " and the answer of qgis was "Warning 6: Driver JPEG does not support scale creation option Warning 6: JPEG driver doesn't support data type Int16. Only eight and twelve bit bands supported (Mk1 libjpeg).

Warning 6: JPEG driver doesn't support data type Int16. Only eight and twelve bit bands supported (Mk1 libjpeg).

Warning 1: One or more pixels clipped to fit 12bit domain for jpeg output."

  Changed 22 months ago by rouault

To avoid the warning about "JPEG driver doesn't support data type Int16", you need to add -ot UInt16 to force unsigned int16.

And the -scale option is not an option of the JPEG driver, but of gdal_translate directly.

You should try to use directly the command line. I don't know how QGIS formats the command line from the things you type in the GUI.

  Changed 22 months ago by rouault

  • status changed from reopened to closed
  • resolution set to invalid
Note: See TracTickets for help on using tickets.