The following question is similar, and shows how to do translation from PNG to NITF on the linux command line using GDAL:
Performing gdal translate to png/jpeg?

I need to do something similar in C++. I have thought about using Nitro, but the licensing may not be compatible with my use case. GDAL's licensing is compatible with our use case, but I cannot find anything similar to gdal_translate in the GDAL C++ libraries. Can anyone shed some light on how I would do this?

The actual use case: Package JPEG image as NITF, and then unpackage the NITF image back to JPEG or other easily displayable format.

  • The normal way to convert between data formats in GDAL C++ is to open the dataset using a particular driver, then write it out to a new file using a different driver. However, recent versions of GDAL include a 'utils' API that short cuts some of this, effectively replicating the command line utilities. These functions are still non-trivial to use, but may still be easier than the manual open-and-save method. See GDALTranslate() at: gdal.org/api/… Aug 22, 2023 at 23:35
  • @SonofaBeach that sounds like an answer ;)
    – user2856
    Aug 23, 2023 at 13:04


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.