NASASpaceFlight.com Forum

General Discussion => Q&A Section => Topic started by: fael097 on 10/24/2019 07:24 pm

Title: convert HIRISE topographic maps into photoshop accepted format?
Post by: fael097 on 10/24/2019 07:24 pm
totally random question, but I downloaded some mars topographic data from https://www.uahirise.org and I need to convert it to some ordinary 16 bit image format so I can use it, but the whole process of converting it seems like rocket science to me.

anyone has any idea how to do so?
Title: Re: convert HIRISE topographic maps into photoshop accepted format?
Post by: leovinus on 10/24/2019 07:53 pm
https://imagemagick.org/index.php
Title: Re: convert HIRISE topographic maps into photoshop accepted format?
Post by: fael097 on 10/24/2019 07:59 pm
heh, I wish it was that simple

HiRISE (High Resolution Imaging Science Experiment) is the most powerful camera ever sent to another planet, one of six instruments onboard the Mars Reconnaissance Orbiter

their website has absurdly large 32bit topographic map files on a digital terrain model (DTM) format called .img (which is definitely not any sort of image format that you can open with an image editor such as photoshop), which my guess is can only be used by nasa. you can download the files as it's free for everyone, but you must use some tool to convert it to some useful format. in my case 16bit png.

their website mentions a software called GDAL that can convert it, but it's an opensource python script sort of thing which I have no idea what to do with it. some people compile into other software I guess.

more about it: https://www.uahirise.org/dtm/about.php

but thanks for trying to help  :)
Title: Re: convert HIRISE topographic maps into photoshop accepted format?
Post by: Swedish chef on 10/24/2019 08:37 pm
After a quick look i noticed that both imagemagick and gimp can handle the img-format.

A guide to open img-files in photoshop
https://www.planetary.org/blogs/emily-lakdawalla/2018/0307-image-processing-trick-raw-photoshop.html

A plugin for gimp to open img-files
http://areo.info/gimp/

And an explanation of what img-files are (Planetary Data System file format)
https://www.fileformat.info/format/pds/egff.htm

Im probably dead wrong since i only used five minutes to research this subject but from what i can tell this looks easy?
Title: Re: convert HIRISE topographic maps into photoshop accepted format?
Post by: leovinus on 10/24/2019 08:49 pm
heh, I wish it was that simple

Fair enough :) Not sure whether there is a straight converter for that format.

However, after looking at "PDS File Format"
http://www.fileformat.info/format/pds/egff.htm
http://www.fileformat.info/format/pds/egff.htm#PDS-DMYID.3
and some python code at
https://github.com/planetarypy/planetaryimage

I took the example download 0600R.IMG and 0600R.LBL at
http://www.fileformat.info/format/pds/sample/index.htm
and after some python foo, get a .PNG out. A bit messy  and not entirely correct, but there is an image ;)

While I realize that you are looking for an easier conversion, here is what I did in case it helps

First, combine files
cat 0600R.LBL 0600R.IMG > 0600R_2.IMG
as when I read the 0600R.IMG only it gives me an error.

Second,

python3

import matplotlib.pyplot as plt
import matplotlib.image as plt2
from planetaryimage import PDS3Image
image = PDS3Image.open('0600R_2.IMG')   
plt2.imsave('picture.png', image.image)

and I can see a planetary shape.

I hope you can find a easier solution. Please keep us posted.
Title: Re: convert HIRISE topographic maps into photoshop accepted format?
Post by: fael097 on 10/25/2019 12:11 am
After a quick look i noticed that both imagemagick and gimp can handle the img-format.

A guide to open img-files in photoshop
https://www.planetary.org/blogs/emily-lakdawalla/2018/0307-image-processing-trick-raw-photoshop.html

A plugin for gimp to open img-files
http://areo.info/gimp/

And an explanation of what img-files are (Planetary Data System file format)
https://www.fileformat.info/format/pds/egff.htm

Im probably dead wrong since i only used five minutes to research this subject but from what i can tell this looks easy?

so, I tried the guide from the planetary society with the image from HiRISE which is 32 bit and I can't seem to get a contrast that will give me any data besides a black image.

the gimp plugin also needs to be compiled apparently and I have no idea how to do so.

but back on the post from the planetary society, they mention a tool that converts it automatically and directly from .img to 16bit .png, and I just tried and it worked flawlessly for these images. I'm in awe

thank you so much!
Title: Re: convert HIRISE topographic maps into photoshop accepted format?
Post by: fael097 on 10/25/2019 12:18 am
heh, I wish it was that simple

Fair enough :) Not sure whether there is a straight converter for that format.

However, after looking at "PDS File Format"
http://www.fileformat.info/format/pds/egff.htm
http://www.fileformat.info/format/pds/egff.htm#PDS-DMYID.3
and some python code at
https://github.com/planetarypy/planetaryimage

I took the example download 0600R.IMG and 0600R.LBL at
http://www.fileformat.info/format/pds/sample/index.htm
and after some python foo, get a .PNG out. A bit messy  and not entirely correct, but there is an image ;)

While I realize that you are looking for an easier conversion, here is what I did in case it helps

First, combine files
cat 0600R.LBL 0600R.IMG > 0600R_2.IMG
as when I read the 0600R.IMG only it gives me an error.

Second,

python3

import matplotlib.pyplot as plt
import matplotlib.image as plt2
from planetaryimage import PDS3Image
image = PDS3Image.open('0600R_2.IMG')   
plt2.imsave('picture.png', image.image)

and I can see a planetary shape.

I hope you can find a easier solution. Please keep us posted.

I tried some things that sounded like this you mentioned, but the thing for me is that I don't know the first thing about python or open source software in general. I mean, when I enter an open source software website I can't even find a download link. github? alien language for me, if I download something there, it's all a bunch of nonsense files. where's the installer or the executable? no guides, instructions, faqs on the website, I get overwhelmed and give up haha.

but see the bost above, the post he mentioned had a link to a tool (.exe file  ;D) that does this automatically and works like a charm, so problem solved

thanks and cheers!
Title: Re: convert HIRISE topographic maps into photoshop accepted format?
Post by: fael097 on 10/25/2019 02:17 am
hey again, smart people. on the same HiRISE pages they have color maps in the jpg2000 format .jp2. some will open with photoshop, but the bigger ones won't, says the file-format module cannot parse the file. any ideas?
Title: Re: convert HIRISE topographic maps into photoshop accepted format?
Post by: Swedish chef on 10/25/2019 11:29 am
hey again, smart people. on the same HiRISE pages they have color maps in the jpg2000 format .jp2. some will open with photoshop, but the bigger ones won't, says the file-format module cannot parse the file. any ideas?

I believe you need to give a more specific example before you could hope for an answer. If you right click over a link to one of the files that wont open in Photoshop, select copy link location and paste that link in this thread. After that one could try it out in other programs and perhaps rule it out as a bad file or a Photoshop problem.