IPB

Welcome Guest ( Log In | Register )

8 Pages V  « < 6 7 8  
Reply to this topicStart new topic
IMG2PNG, PDS/FITS to PNG conversion
neo56
post Oct 26 2016, 01:53 PM
Post #106


Member
***

Group: Members
Posts: 420
Joined: 3-June 04
From: Brittany, France
Member No.: 79



Bjorn, are you developing or do you plan to develop a version of IMG2PNG for Mac ? That would be awesome.


--------------------
Go to the top of the page
 
+Quote Post
scalbers
post Dec 3 2016, 11:48 PM
Post #107


Senior Member
****

Group: Members
Posts: 1252
Joined: 5-March 05
From: Boulder, CO
Member No.: 184



I'm checking how well GDAL works on a Mac to convert IMG files, at least in a rudimentary manner. I am able to do this with some files from a USGS Earth topography database. I wonder if their IMG format is the same thing as in the PDS?


--------------------
Go to the top of the page
 
+Quote Post
Rick Ramirez
post Feb 23 2017, 02:49 AM
Post #108


Newbie
*

Group: Members
Posts: 2
Joined: 22-February 17
Member No.: 8126



I've been having some trouble getting the results I expect from IMG2PNG. It's probably user error but I'm wondering if someone can help me. I'm trying to create a full 16-bit displacement map for the moon. The Tiff files available here (http://wms.lroc.asu.edu/lroc/view_rdr/WAC_GLD100) are only 8 bit. I've downloaded all of the .img PDS files to try and produce correct 16-bit images but I'm having no luck. Running the converter tells me that sample_bits=16 but the PNG file produced is severely clipped. The resulting PNGs have black and white data ranging from 0 to about 0.05. I've tried using -fneg and also playing around with -fStretch without much luck. These are processed LROC images so I didn't think I needed any kind of calibration files. Am I incorrect? If anyone has any clues, I would very much appreciate it.
Go to the top of the page
 
+Quote Post
JohnVV
post Feb 23 2017, 06:22 AM
Post #109


Member
***

Group: Members
Posts: 816
Joined: 18-November 08
Member No.: 4489



the pds img files are here
http://lroc.sese.asu.edu/data/LRO-L-LROC-5...SDP/WAC_GLD100/

the img is a 16 bit SIGNED integer
gdal can convert a img to a tiff ( geo tiff)
example :
CODE
gdal_translate WAC_GLD100_E000N1800_016P.IMG WAC_GLD100_E000N1800_016P.IMG.tiff

a screenshot from Nip2 image editor


a height map heeds to be at least 16 bit depth or 32 bit float
Go to the top of the page
 
+Quote Post
elakdawalla
post Feb 23 2017, 06:22 PM
Post #110


Administrator
****

Group: Admin
Posts: 5022
Joined: 4-August 05
From: Pasadena, CA, USA, Earth
Member No.: 454



QUOTE (Rick Ramirez @ Feb 22 2017, 06:49 PM) *
I've been having some trouble getting the results I expect from IMG2PNG. It's probably user error but I'm wondering if someone can help me. I'm trying to create a full 16-bit displacement map for the moon. The Tiff files available here (http://wms.lroc.asu.edu/lroc/view_rdr/WAC_GLD100) are only 8 bit. I've downloaded all of the .img PDS files to try and produce correct 16-bit images but I'm having no luck. Running the converter tells me that sample_bits=16 but the PNG file produced is severely clipped. The resulting PNGs have black and white data ranging from 0 to about 0.05. I've tried using -fneg and also playing around with -fStretch without much luck. These are processed LROC images so I didn't think I needed any kind of calibration files. Am I incorrect? If anyone has any clues, I would very much appreciate it.


Have you tried the -s switch (like -s1024) to multiply all the pixels by a number?




--------------------
My blog - @elakdawalla on Twitter - Please support unmannedspaceflight.com by donating here.
Go to the top of the page
 
+Quote Post
JohnVV
post Feb 23 2017, 08:30 PM
Post #111


Member
***

Group: Members
Posts: 816
Joined: 18-November 08
Member No.: 4489



the clipping is do to the img file being a SIGNED!!! integer in meters above and BELOW!!! "sea level"

that is -8967 METERS to a + 10714 Meters

using a multiplier will NOT put this into a unsigned range

16 bit signed pixel values ( -32768 to +32767 )
16 bit UNsigned pixel values ( 0 to 65538 )

you can use math functions
SUBTRACT the negative minimal value ( or add the min. absolute value ) to the image
an example using the G'mic image lib
CODE

gmic WAC_GLD100_E000N1800_016P.IMG.tiff -add 8967 -o WAC_GLD100_E000N1800_016P.16U.tiff,ushort
Go to the top of the page
 
+Quote Post
elakdawalla
post Feb 23 2017, 09:03 PM
Post #112


Administrator
****

Group: Admin
Posts: 5022
Joined: 4-August 05
From: Pasadena, CA, USA, Earth
Member No.: 454



Ah, right. I don't know that IMG2PNG currently handles signed data. But Bjorn is always tinkering with it so it's possible it could do so in the future.


--------------------
My blog - @elakdawalla on Twitter - Please support unmannedspaceflight.com by donating here.
Go to the top of the page
 
+Quote Post
Rick Ramirez
post Feb 24 2017, 05:50 PM
Post #113


Newbie
*

Group: Members
Posts: 2
Joined: 22-February 17
Member No.: 8126



Thanks for the help. I didn't realize IMG2PNG could not handle negative values. I haven't used GDAL of GMIC but I'll check them out.
Go to the top of the page
 
+Quote Post
Bjorn Jonsson
post Mar 6 2017, 11:14 PM
Post #114


IMG to PNG GOD
****

Group: Moderator
Posts: 1864
Joined: 19-February 04
From: Near fire and ice
Member No.: 38



I took a look at this and it's a bug in IMG2PNG that should soon be fixed. The problem is that 'normal' images usually do not contain signed data (and therefore no negative values) but this is a DEM and DEMs obviously can contain negative values. IMG2PNG recognizes some files as DEMs and handles them correctly but this DEM is 'unknown' to IMG2PNG. I'll probably add a new command line parameter to make it possible to tell IMG2PNG that the input file is a DEM in case IMG2PNG doesn't correctly recognize it as a DEM.
Go to the top of the page
 
+Quote Post
Bjorn Jonsson
post May 1 2017, 03:48 PM
Post #115


IMG to PNG GOD
****

Group: Moderator
Posts: 1864
Joined: 19-February 04
From: Near fire and ice
Member No.: 38



QUOTE (Rick Ramirez @ Feb 23 2017, 02:49 AM) *
I've been having some trouble getting the results I expect from IMG2PNG. It's probably user error but I'm wondering if someone can help me. I'm trying to create a full 16-bit displacement map for the moon. The Tiff files available here (http://wms.lroc.asu.edu/lroc/view_rdr/WAC_GLD100) are only 8 bit. I've downloaded all of the .img PDS files to try and produce correct 16-bit images but I'm having no luck. Running the converter tells me that sample_bits=16 but the PNG file produced is severely clipped. The resulting PNGs have black and white data ranging from 0 to about 0.05. I've tried using -fneg and also playing around with -fStretch without much luck. These are processed LROC images so I didn't think I needed any kind of calibration files. Am I incorrect? If anyone has any clues, I would very much appreciate it.

This has now been fixed and a new IMG2PNG version is now available. I added a new command line option (-force_dem) which forces IMG2PNG to treat the input file(s) as a DEM if possible (the sample type must be signed which is the case for all of the DEMs I've seen).

IMG2PNG is available here:

http://bjj.mmedia.is/utils/img2png/index.html
Go to the top of the page
 
+Quote Post
Bjorn Jonsson
post May 3 2017, 12:24 AM
Post #116


IMG to PNG GOD
****

Group: Moderator
Posts: 1864
Joined: 19-February 04
From: Near fire and ice
Member No.: 38



It has come to my attention that for some reason the upload of the new IMG2PNG version mentioned in the preceding post didn't succeed - the old version did not get replaced. So if you have downloaded the new version above to get the improved DEM handling you need to do so again - I have verified that this time the upload succeeded. Sorry for the inconvenience.

The new version should output this when you run it:

IMG2PNG v2.35 20170501
Go to the top of the page
 
+Quote Post

8 Pages V  « < 6 7 8
Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 29th May 2017 - 11:24 AM
RULES AND GUIDELINES
Please read the Forum Rules and Guidelines before posting.

IMAGE COPYRIGHT
Images posted on UnmannedSpaceflight.com may be copyrighted. Do not reproduce without permission. Read here for further information on space images and copyright.

OPINIONS AND MODERATION
Opinions expressed on UnmannedSpaceflight.com are those of the individual posters and do not necessarily reflect the opinions of UnmannedSpaceflight.com or The Planetary Society. The all-volunteer UnmannedSpaceflight.com moderation team is wholly independent of The Planetary Society. The Planetary Society has no influence over decisions made by the UnmannedSpaceflight.com moderators.
SUPPORT THE FORUM
Unmannedspaceflight.com is a project of the Planetary Society and is funded by donations from visitors and members. Help keep this forum up and running by contributing here.