[gdal-dev] What happens by default when writing RGBA into jpeg?

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Tue Jun 10 06:03:24 PDT 2014


Even Rouault <even.rouault <at> mines-paris.org> writes:

> > Hi Even,
> >
> > Sorry, I must have been unclear. The question was about writing out a real
> > JPEG file, not JPEG compressed TIFF
> 
> Ah my fault. I read too fast.
> 
> > The command gdal_translate -of jpeg rgba_in.tif jpeg_out.jpg creates a jpeg
> > file with this gdalinfo
> >
> > C:\Jukka>gdalinfo jpeg_out.jpg
> [...]
> >   SOURCE_COLOR_SPACE=CMYK
> 
> My guess was right actually. In JPEG there's no way, AFAIK, to define RGBA. 4
> bands JPEG are assumed to be in CMYK color space.
> 

Thanks, that makes sense. However, the result is somehow surprising and I
guess that in most cases unusable for the user. I wonder if it would be good
to print something like "WARNING. Encountered 4 source bands, assuming CMYC
color space". Behaviour is not very easy to understand by reading the driver
page http://www.gdal.org/frmt_jpeg.html

When I try to look at the situation as a QGIS user sees it, it feels like
there is a bug somewhere but I can't say exactly where. However, I do not
believe that any average QGIS user can have success with converting their
RGBA tiffs into jpeg format even it is possible by editing gdal_translate
command manually.

-Jukka-





More information about the gdal-dev mailing list