[Gdal-dev] About CMYK image support of GDAL

Frank Warmerdam warmerdam at pobox.com
Sun Apr 18 22:30:00 EDT 2004


xqcheng wrote:
> Hi,All
>   two questions:
>   1.
>   I didn't know whether it is a bug or not.
>   When I open a TIFF image(CMYK color coded in photoshop),
>   And test its color attribute of band 1, The GetColorInterpretation()
>   returns 1 ,that is G/CI_PaletteIndex/ /,not //GCI_CyanBand/ /!/
> /  /When/  I/ open a JPEG image(CMYK color coded in photoshop),GDAL 
> simply returns...
>   cannot open!
>   So is GDAL has limited support for CMYK images ?

Good point.  Could you provide a smallish CMYK image so this
can be corrected and tested?

>  2. How can i get the resolution of image opened by GDAL?
>     which function of GDAL can do that?
> Thanks for reply!
> CXQ 

Call the GetGeoTransform() method.  For a north up image the
pixel width is the second element in the array and the pixel
height is the sixth element (but will be negative).   The
corresponding C function is GDALGetGeoTransform().  Hopefully this
example from gdalinfo will be illustrative:

/* -------------------------------------------------------------------- */
/*      Report Geotransform.                                            */
/* -------------------------------------------------------------------- */
    if( GDALGetGeoTransform( hDataset, adfGeoTransform ) == CE_None )
    {
        if( adfGeoTransform[2] == 0.0 && adfGeoTransform[4] == 0.0 )
        {
            printf( "Origin = (%.6f,%.6f)\n",
                    adfGeoTransform[0], adfGeoTransform[3] );

            printf( "Pixel Size = (%.8f,%.8f)\n",
                    adfGeoTransform[1], adfGeoTransform[5] );
        }
        else
            printf( "GeoTransform =\n"
                    "  %.16g, %.16g, %.16g\n"
                    "  %.16g, %.16g, %.16g\n",
                    adfGeoTransform[0],
                    adfGeoTransform[1],
                    adfGeoTransform[2],
                    adfGeoTransform[3],
                    adfGeoTransform[4],
                    adfGeoTransform[5] );
    }


Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list