Opened 13 years ago

Closed 13 years ago

#4185 closed defect (invalid)

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 (2)

line of sight tif srtm2317 (33.0 KB ) - added by tunofilho 13 years ago.
line of sight jpeg srtm2317 (28.8 KB ) - added by tunofilho 13 years ago.

Download all attachments as: .zip

Change History (6)

by tunofilho, 13 years ago

Attachment: line of sight tif srtm2317 added

by tunofilho, 13 years ago

Attachment: line of sight jpeg srtm2317 added

comment:1 by Even Rouault, 13 years ago

Resolution: invalid
Status: newclosed

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 comment:2 by tunofilho, 13 years ago

Resolution: invalid
Status: closedreopened

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."

comment:3 by Even Rouault, 13 years ago

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.

comment:4 by Even Rouault, 13 years ago

Resolution: invalid
Status: reopenedclosed
Note: See TracTickets for help on using tickets.