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

Jean-Claude Repetto jean-claude.repetto at worldonline.fr
Tue Dec 19 11:09:57 EST 2006


Frank Warmerdam a écrit :
> 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,

Hello Frank,

Thanks for your answer. I understand that ECW does not support palettes, 
but I think gdal_translate should :
- either convert the image to 24bit before converting it to ECW
- either print an error message and stop.

Best regards,
Jean-Claude




More information about the Gdal-dev mailing list