[gdal-dev] Creating jpeg compressed tiff with alpha

Livneh Yehiyam yehil at rafael.co.il
Mon Jul 2 04:01:41 PDT 2012


Even
Thanks for your quick reply.
Converting the same image with global mapper gives me different results:

Driver: GTiff/GeoTIFF
Files: C:\Users\Atlas\Pictures\2.tif
Size is 480, 360
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223560493,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["arc-second",4.848136811095361e-006],
    AUTHORITY["EPSG","4326"]]
Origin = (0.000000000000000,360.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=JPEG
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (       0.000,     360.000) (  0d 0' 0.01"E,360d 0' 0.00"N)
Lower Left  (   0.0000000,   0.0000000) (  0d 0' 0.01"E,  0d 0' 0.01"N)
Upper Right (     480.000,     360.000) (Invalid angle,360d 0' 0.00"N)
Lower Right (     480.000,       0.000) (Invalid angle,  0d 0' 0.01"N)
Center      (     240.000,     180.000) (240d 0' 0.00"E,180d 0' 0.00"N)
Band 1 Block=128x128 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=128x128 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=128x128 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=128x128 Type=Byte, ColorInterp=Alpha
Press any key to continue . . .

Is there a way to get the same result with gdal? I see that the mask flag is different (PER_DATASET ALPHA)

Thanks
Yehiyam
________________________________________
From: Even Rouault [even.rouault at mines-paris.org]
Sent: Monday, July 02, 2012 1:56 PM
To: Livneh Yehiyam
Cc: gdal-dev  (gdal-dev at lists.osgeo.org)
Subject: Re: [gdal-dev] Creating jpeg compressed tiff with alpha

Yehiyam,

Your command worked fine. It is just that your expectations are wrong. It will
produce a mask band, and not a alpha band. This is indicated by the following
line in the gdalinfo report :

><table align='center'><tr><td></td></tr></table>   Mask Flags: PER_DATASET

(a mask band that is common to all the regular bands of the dataset)

Mask bands can be obtained with GDALGetMaskBand(). But admitedly, I guess that
few software packages are able to deal with them. For example, recent versions
of MapServer will try using mask band if no alpha band is found.

Best regards,

Even
**********************************************************************************************
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.
**********************************************************************************************



More information about the gdal-dev mailing list