[GRASS-user] Exporting RGB Composite Images to GeoTIFF

Moritz Lennert mlennert at club.worldonline.be
Sun Jul 24 02:23:29 PDT 2016


On 22/07/16 18:07, Michele Toma wrote:
>
> I was able to resolve my issue (export the composite image so that
> it can be opened in Global Mapper and Photoshop) by opening it in
> QGIS using the GRASS Tools plugin. Click “Add raster layer” button
> and navigate to the composite image and click OK. Once it was added
> to QGIS, I right-clicked the raster layer in the Layer menu and
> selected the Save As… option. Then in the Save As… window, I selected
> “rendered image” as the output and left all other options as the
> default. This newly exported image allowed me to open the it in other
> programs.
>

Happy that you found a solution for yourself, but this should "just
work" in GRASS as well.

To get back to your original issues:

On 21/07/16 02:53, Michele Toma wrote:
> I am having trouble exporting a composite RGB image into a GeoTIFF
> format that I can open in Global Mapper, Photoshop, or other
> programs. This is using Landsat 8 imagery. I am able to open the
> composite image in QGIS, but not in Global Mapper or Photoshop.

Can you really not open it, or it just appears black/grey or something
like this ? GeoTIFF metadata cannot be handled by many normal graphic
programs.

If your interested, here's the lengthy discussion on these issues: 
http://trac.osgeo.org/grass/ticket/73

As a result the manual page now states:

"r.out.gdal exports may appear all black or gray on initial display in 
other GIS software. This is not a bug of r.out.gdal, but often caused by 
the default color table assigned by that software. The default color 
table may be grayscale covering the whole range of possible values which 
is very large for e.g. Int32 or Float32. E.g. stretching the color table 
to actual min/max would help (sometimes under symbology)."

and

"GeoTIFF caveats

GeoTIFF exports can only be displayed by standard image viewers if the 
GDAL data type was set to Byte and the GeoTIFF contains either one or 
three bands. All other data types and numbers of bands can be properly 
read with GIS software only. Although GeoTIFF files usually have a .tif 
extension, these files are not necessarily images but first of all 
spatial raster datasets, e.g. SRTM DEM version 4."

and a bit further in the "Improving GeoTIFF compatibility" section:

"Skip exporting the color table. Color tables are not always properly 
rendered, particularly for type UInt16, and the GeoTIFF file can appear 
completely black. If you are lucky the problematic software package has 
a method to reset the color table and assign a new color table 
(sometimes called symbology). "

Another issue is color table handling, which also differs from program.

When you open it in QGIS, does it open with the same colors as in GRASS ?

[...]

>
> a.       i.colors.enhance red=brovey.red at Osaka
> green=brovey.green at Osaka blue=brovey.blue at Osaka
>
> 6.       Create composite RGB. I’ve run the two commands below and
> both do not produce what I need:

Could you explain exactly what it is you expected and that you didn't get ?

>
> a.       r.out.gdal input=brovey.rgb at Osaka output=brovey.rgb.tif
> format=GTiff

Where does brovey.rgb come from ? r.composite ?


>
>
> Another method that I have tried using an example on the r.out.gdal
> documentation page:
>
>
>
> i.group group=brovey_group input=brovey.red,brovey.green,brovey.blue
>
> g.region rast=brovey.blue -p
>
> r.out.gdal in=brovey_group output=brovey_group.tif type=Float64 \
>
> createopt="PROFILE=GeoTIFF,INTERLEAVE=PIXEL,TFW=YES"
>
>

type=Float64 cannot be handled by many software packages...

>
> The result is an image with distorted colors when opened in QGIS.
> Water has turned a reddish brown color.

You can try to export the color table with r.colors.out and massage the 
output to use it as input for QGIS.

At this stage, I don't really understand, yet, what your issue actually 
was:

- color table export from GRASS to other software ?
- defining the tiff's parameter so it can be read by other software ?
- something else ?


Moritz


More information about the grass-user mailing list