Using GDAL 2.4.0 with OpenJPEG 2000 v2.3.0.
gdalinfo reports all four bands of NAIP imagery as "Unknown" colorinterp. Sample image here: https://prd-tnm.s3.amazonaws.com/StagedProducts/NAIP/id_2015/46115/m_4611501_sw_11_1_20150702_20151207.jp2
This messes up apps like mapserver, which are then unable to serve out color images.
I attempted to add colorinterp information via an .aux.xml sidecar file. Gdalinfo reports that the sidecar file is detected and read, but the colorinterp is still unknown. Sidecar file contents below (what is shown is the entire file).
Googling around, I see reference to the openjpeg2000 driver using the sidecar file for georeferencing, but no mention of using it for colorinterp metadata. Can I fix the colorinterp using a sidecar file?
I know I can fix colorinterp by doing gdal_translate, but I have an awful lot of these files (~4TB), and any gdal_translation produces files 3x - 4x bigger. I want to avoid having the files get that big. I suspect the commercial encoders USDA is using are better than OpenJPEG2000, so I'd love to just leave the files alone and interpret the existing bands correctly. How would I do that?
<PAMDataset>
<PAMRasterBand band="1">
<ColorInterp>Red</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="2">
<ColorInterp>Green</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="3">
<ColorInterp>Blue</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
<PAMRasterBand band="4">
<ColorInterp>Grey</ColorInterp>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
PROCESSING "BANDS=1,2,3"
. – user30184 Mar 24 '19 at 12:16