<div dir="auto">Hi Nathan,<div dir="auto"><br></div><div dir="auto">My initial suspicion might just be that the scaling the data provider did to go from the raw data to a human-eye-friendly RGB composite isn't the conversion you're assuming.</div><div dir="auto"><br></div><div dir="auto">I know that with the data I regularly work with, it may be provided as Uint16, but the data range doesn't extend all the way to 65535.</div><div dir="auto"><br></div><div dir="auto">If you compare the values in the separate R and G images to the RGB composite, do they appear to match the conversion you're assuming, or is there a different scaling (and possibly offset)?</div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Daniel</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 22 Apr 2024, 15:20 Raley, Nathan via gdal-dev, <<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<div class="m_-4897717753140938190WordSection1">
<p class="MsoNormal">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.<br>
<br>
Can anyone shed some light as to what I may be doing wrong here?<br>
<br>
I started by building a VRT for each band:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">gdal_translate source_RGB.tif b.vrt -ot UInt16 -of VRT -b 3 -scale 0 255 0 65535
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">gdalbuildvrt -b 1 r.vrt source_R.tif<br>
gdalbuildvrt -b 1 g.vrt source_G.tif<br>
gdalbuildvrt -b 1 nir.vrt source_NIR.tif<br>
gdalbuildvrt -b 1 re.vrt source_RE.tif<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<p class="MsoNormal">I then merged the VRTs:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">gdalbuildvrt -separate multispec.vrt r.vrt g.vrt b.vrt nir.vrt re.vrt<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<p class="MsoNormal">I now have a multispec.vrt with the R, G, B, NIR, and RE bands, all with a UInt16 datatype.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Now, I attempted to rebuild a RGB GeoTiff from the composite VRT with something like:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">gdal_translate -ot Byte -of GTiff -b 1 -b 2 -b 3 -scale 0 65535 0 255 -co PHOTOMETRIC=RGB multispec.vrt multispec.tif<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Viewing the result in QGIS appears overly blue. What am I doing wrong here?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal">Nathan <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<hr><font size="1">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.</font>
</div></div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank" rel="noreferrer">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div>