Jump to content
PDS Geosciences Node Community

Which tool converts PDS4 Mars 2020 images to 16 bit/channel PNG or TIFF?

Holger Isenberg

Recommended Posts

I'm searching for software to convert PDS4 .xml/.img from of the Mars 2020 cameras to 16 bit/channel PNG, TIFF or other lossless formatted files.

So far couldn't find any which runs on current macOS: NASAView https://pds.nasa.gov/tools/about/pds3-tools/nasa-view.shtml is not available for current macOS, the Java-based transform only writes 8 bit (https://github.com/NASA-PDS/transform/issues/15), the Python PDS4viewer https://pypi.org/project/pds4-tools/ only writes 8bit as well and my years old PDS plugin for GIMP doesn't work on recent versions. The APIs used by transform and pds4-tools are most likely supporting 16 bit already, but before spending time to write my own software around those I like to ask here if something is available.

Link to comment
Share on other sites


Please have a try of GDAL (https://gdal.org/index.html), which can read the PDS4 img and converted it to a 16-bit tif. You may need a high version of GDAL, which supports PDS4.
The version I used was 3.5.1 released on 2022/06/30. I tested on the mars2020 Super Camera Remote Micro Imager data with below GDAL command (https://gdal.org/programs/gdal_translate.html). It returned a 16bit GeoTiff.

gdal_translate -ot Int16 -of GTiff D:\test\data\mars2020\20200816\LRE_0080_0674037605_189ECM_N0032430SCAM02080_0340I6J04.xml D:\test\data\mars2020\20200816\LRE_0080_0674037605_189ECM_N0032430SCAM02080_0340I6J04_gdal.tif

Please let me know if you need more help. Thanks,


Link to comment
Share on other sites

That's great news, thanks! Works fine also for PNG 16 bit output I see:

gdal_translate -ot UInt16 -of PNG SOME_EDR.xml SOME_EDR.png

The resulting linear PNG and TIFF from EDR.imgs have intensity values 0 - 2033 which matches the tabulated 12/8 bit LUT for Mastcam-Z. That means the output is not stretched during conversion, which is best for correct calibration.

Installation on current macOS was also simple: brew install gdal

I see that it is also listed on https://pds.nasa.gov/tools/tool-registry/ when selecting transform / pds4, but I missed it due to the highly encoded description there as "translator library for raster and vector geospatial data formats" which didn't looked like some simple to use command line tool.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...