[Gdal-dev] Block size consistency (and SetColorInterpretation() in GTiff)

Frank Warmerdam warmerdam at pobox.com
Wed Feb 7 15:14:34 EST 2007

Ozy Sjahputera wrote:
> You are probably right.  I am just trying to rule out any possible 
> source of image "shift" that I am seeing.
> Using RasterIO instead of block write/read seems to increase my 
> computation time by 40-50%.  If I find the source of error to be 
> something else unrelated to block size, I will go back to using 
> blockWrite/Read.  Still looking now.


Whew, that is substantial overhead.  I'm surprised, and somewhat

> Frank, one more thing, when I use "Create()" from "GTiff" driver, I 
> cannot assign the band name in the new image using :         
> dstBand->SetColorInterpretation(srcBand->GetColorInterpretation());
> I always get :    ERROR 6: SetColorInterpretation() not supported for 
> this dataset. However, the first band in the new image seems to have 
> "gray" as the band name, while others are "undefined" due to the error 
> above.
> But I can do SetColorInterpretation() above if I use "Create()" from 
> "MEM" driver.
> Is this a limitation of GTiff driver in GDAL now?  Is there a way I can 
> assign the band name after using "Create()" from GTiff driver?

There is a distinct concept of band names (descriptions).  But here
you just seem interested in photometric intepretation.

The GeoTIFF driver has very limited support for setting the photometric
interpretation of bands after the file has been created.   I think the
only aspect of this that actually does something is if you set an
extra band to be alpha, it records that in the TIFF file.

If you would like a 3 or more band file to have a TIFF level photometric
interpretation of RGB you can set it using the PHOTOMETRIC=RGB creation
option at Create() time.

This is an example of a situation where Create() then modify doesn't
work well due to lots of stuff getting locked down at the point the
create is completed.

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    | President OSGeo, http://osgeo.org

More information about the Gdal-dev mailing list