[gdal-dev] Question on building multi band composite and going back to RGB GeoTiff

Raley, Nathan nraley at gaig.com
Mon Apr 22 07:19:54 PDT 2024


I currently have a RGB geotiff composite image that has a Byte datatype.  I also have individual band images for R, G, Redge, and NIR that are UInt16 datatypes.  Since I'm missing the Blue band from the individual bands, I was attempting to extract the blue band from the RGB composite image, scale it up to the UInt16 datatype, and build a composite VRT with R, G, B, NIR, RE bands included in it.  I was then attempting to extract the RGB bands from the multispec VRT in order to see if the process was working as intended, but I'm getting an extremely blue image.

Can anyone shed some light as to what I may be doing wrong here?

I started by building a VRT for each band:
gdal_translate source_RGB.tif b.vrt -ot UInt16 -of VRT -b 3 -scale 0 255 0 65535
gdalbuildvrt -b 1 r.vrt source_R.tif
gdalbuildvrt -b 1 g.vrt source_G.tif
gdalbuildvrt -b 1 nir.vrt source_NIR.tif
gdalbuildvrt -b 1 re.vrt source_RE.tif

I then merged the VRTs:
gdalbuildvrt -separate multispec.vrt r.vrt g.vrt b.vrt nir.vrt re.vrt

I now have a multispec.vrt with the R, G, B, NIR, and RE bands, all with a UInt16 datatype.

Now, I attempted to rebuild a RGB GeoTiff from the composite VRT with something like:
gdal_translate -ot Byte -of GTiff -b 1 -b 2 -b 3 -scale 0 65535 0 255 -co PHOTOMETRIC=RGB multispec.vrt multispec.tif

Viewing the result in QGIS appears overly blue.  What am I doing wrong here?

Thanks,
Nathan

This email transmission, including any attachments, is intended solely for the addressee named above, and may contain confidential or privileged information. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender immediately by reply email and destroy the message and its attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240422/235b1515/attachment-0001.htm>


More information about the gdal-dev mailing list