Skip to content
Prev 18119 / 29559 Next

writeRaster and RGB vs Gray

On Fri, Apr 26, 2013 at 8:25 PM, MacQueen, Don <macqueen1 at llnl.gov> wrote:
Hmmm. I think QGIS just makes a guess that any 3-band image is R,G
and B. But there must be some tag in a tiff file that specifies this
explicitly...

  If I create a tif as above, and also create one with gimp, then I
can run 'tiffinfo' on them:

 The R one has "Photometric Interpretation: min-is-black", whereas the
Gimp one has "RGB Color". The problem is now how to change that tag in
the R output tiff!

 This can be done on the command line:

tiffset -s 262 2 s.tif

 where 262 is the id of the photometric interpretation tag and 2 means
'rgb': http://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html

 but I can't see how to do this in writeRaster...

 ah ha.

writeRaster([all that other stuff], options="PHOTOMETRIC=RGB")

got from the list of gdal driver options: http://www.gdal.org/frmt_gtiff.html

sorted.

Barry