[gdal-dev] Extracting Jpeg2000 image from nitf file

Brad Hards bradh at frogmouth.net
Fri May 26 23:22:09 PDT 2023


On Friday, 26 May 2023 8:09:50 PM AEST Even Rouault wrote:
> Hi,
> 
> if you open such an image with debug traces (CPL_DEBUG=ON), you'll see
> something like
> 
> GDAL: GDALOpen(/vsisubfile/907_565,byte.ntf, this=....) succeeds as
> JP2OpenJPEG
> 
> which means that the JPEG2000 file starts at byte 907 with a length of
> 565 bytes.
> 
> Programatically from C/C++ , you could use the GDALGetOpenDatasets()
> methods after having opening the NITF file, and look for /vsisubfile/ files

I would caution that this will give you the image segment (amongst other 
segments, possibly), which may not correspond directly to the JPEG 2000 
codestream. In particular, if you have M8 compression, you may need to parse 
the image mask table off the front of that data. Also, depending on what the 
data is, the actual imagery may need to have LUT processing applied, etc.

Brad




More information about the gdal-dev mailing list