[gdal-dev] RGB Geotiff with jpeg compress

Even Rouault even.rouault at spatialys.com
Wed Sep 23 06:23:50 PDT 2020


On mercredi 23 septembre 2020 15:02:42 CEST APM wrote:
> Dear all,
> 
> 
> I like to compress a Geotiff rastermap with compress=jpeg.
> 
> 
> gdalinfo for a .vrt which I like to compress:
> 
> Coordinate System is:
> PROJCRS["ETRS89 / UTM zone 32N",
>      BASEGEOGCRS["ETRS89",
>          DATUM["European Terrestrial Reference System 1989",
>              ELLIPSOID["GRS 1980",6378137,298.257222101,
>                  LENGTHUNIT["metre",1]]],
> 
> .
> 
> .
> 
> 
> Band 1 Block=128x128 Type=Byte, ColorInterp=Palette
>    Color Table (RGB with 256 entries)
>      0: 255,255,255,255
>      1: 255,255,255,255
>      2: 255,255,255,255
>      3: 191,230,230,255
>      4: 153,255,179,255
>      5: 230,255,204,255
>      6: 191,242,128,255
> 
> .
> 
> .
> 
> gdal_translate dtk25.vrt -co COMPRESS=JPEG out.tiff
> 
> Input file size is 201600, 198400
> 
> 0ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
> ERROR 1: An error occurred while writing a dirty block from
> GDALRasterBand::IRasterIO
> ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
> ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG

Color table and JPEG compression don't go together.
You may add "-expand rgb" to your gdal_translate command line to convert from the color 
palette into a RGB image.

Or keep a paletted image but use a lossless compression scheme such as LZW or DEFLATE.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200923/2cd8a9ff/attachment-0001.html>


More information about the gdal-dev mailing list