[gdal-dev] Return codes in gdalwarp

Michal Migurski mike at stamen.com
Sat Nov 14 01:47:58 EST 2009


On Nov 13, 2009, at 8:23 AM, Christopher Barker wrote:

> Michal Migurski wrote:
>> The GTiff files that I might see as input to this script include  
>> palette and non-palette images,
>
>> This didn't work with palette images, for which I got an error  
>> like: "ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not  
>> allowed for JPEG"
>
> Enhanced error reporting would be great, but this particular issue  
> could (should) be addressed in another way.
>
> It's a pretty common case that visual images can be stored either as  
> palette or RGB(A). However, when you want to re-size, or warp an  
> image, palette often doesn't work well -- you'll generally get a  
> better image if you allow interpolated (anti-aliased) colors.
>
> In your case, I'd probably convert all the palette images to RGB,  
> then do your warping, which would solve your compression issue, as  
> well as give you better results.
>
> It would be nice if GDAL could (optionally) do this on-the0fly  
> internally, when  re-scaling or warping images, but I don't think it  
> can (am I wrong?)

Thanks for the suggestion. It makes sense, though it seems that  
gdal_translate can't do this natively, is that true? I'm looking at  
resources like http://w3.cs.jmu.edu/arch/schol/software/gdal-sup/All.html 
  and they seem to indicate that there's no native palette-to-RGB  
conversion offered in gdal_translate, and I can't find any in the docs.

-mike.

----------------------------------------------------------------
michal migurski- mike at stamen.com
                  415.558.1610




More information about the gdal-dev mailing list