[Gdal-dev] Conversion of paletted PNG to ECW does not work

Frank Warmerdam warmerdam at pobox.com
Tue Dec 19 20:27:33 EST 2006


Jean-Claude Repetto wrote:
> Hello,
> 
> When I convert a paletted PNG file to ECW, the resulting image is almost 
> black, as if the compression was made using the indexes instead of the 
> real colours.
> 
> I am using GDAL 1.3.2 on Gentoo-64.
> Example:
> gdal_translate -of ECW -co "TARGET=94%" -co "DATUM=NTF"  -co 
> "PROJ=LM1FRA2D" -a_ullr  a_ullr 970000 1860000 980000 1850000 test.png 
> test.ecw
> 
> There is no problem with a true colour PNG image.
> 
> Is it a known bug ?

Jean-Claude,

It is a known "feature".

ECW does not support palettes so what you need to do is first convert your
8bit+palette image into a 24bit RGB image.  This can be accomplished using
the pct2rgb.py script if you have a full (python enabled) build of GDAL
such as you get with FWTools.

   pct2rgb.py test.png test24.tif
   gdal_translate ... test24.tif test.ecw

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list