[gdal-dev] Creating jpeg compressed tiff with alpha

Livneh Yehiyam yehil at rafael.co.il
Mon Jul 2 03:42:37 PDT 2012

I'm having problems creating a jpeg compressed tif with ARGB pixel format with gdal_translate.
I tried the command
gdal_translate pngWithAlpha.png 3.tif -b 1 -b 2 -b 3 -mask 4 -co alpha=yes -co COMPRESS=JPEG  --config GDAL_TIFF_INTERNAL_MASK YES

as it appears in the gdal_translate documentation, but the image I'm getting doesn't have an alpha channel.
c:\Users\Atlas\Pictures>gdalinfo 3.tif
Driver: GTiff/GeoTIFF
Files: 3.tif
Size is 480, 360
Coordinate System is `'
Image Structure Metadata:
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  360.0)
Upper Right (  480.0,    0.0)
Lower Right (  480.0,  360.0)
Center      (  240.0,  180.0)
Band 1 Block=480x16 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET
Band 2 Block=480x16 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET
Band 3 Block=480x16 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET

I also tried without the -mask option, in which case I get errors:
ERROR 1: JPEGLib:Bogus input colorspace
ERROR 1: WriteEncodedTile/Strip() failed.

I'm using gdal 1.9.1 x64 on windows 7 64 bit.

Is there another way to do this, or is it a known limitation of the tiff driver?


This message (including any attachments) issued by RAFAEL- ADVANCED DEFENSE SYSTEMS LTD. 
(hereinafter "RAFAEL") contains confidential information intended for a specific individual and purpose, may 
constitute information that is privileged or confidential or otherwise protected from disclosure. If you are not 
the intended recipient, you should contact us immediately and thereafter delete this message from your 
system. You are hereby notified that any disclosure, copying, dissemination, distribution or forwarding of this 
message, or the taking of any action based on it, is strictly prohibited. If you have received this e-mail in error, 
please notify us immediately by e-mail mailto:lawraf at rafael.co.il and completely delete or destroy any and all 
electronic or other copies of the original message and any attachments thereof.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120702/ea0c4c4c/attachment.html>

More information about the gdal-dev mailing list