IPB

Welcome Guest ( Log In | Register )

9 Pages V  « < 6 7 8 9 >  
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: 807
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: 1620
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?


--------------------
Steve [ my home page and planetary maps page ]
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: 890
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: 5172
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 website - My Patreon - @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: 890
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: 5172
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 website - My Patreon - @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: 2250
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: 2250
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: 2250
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
Suchandler96
post Jul 3 2017, 04:32 AM
Post #117


Newbie
*

Group: Members
Posts: 1
Joined: 6-June 17
Member No.: 8185



I am recently handling the viking orbiter raw images, and in some images there are so many vertical missing lines that they are almost unreadable. I have found a software which can be found at
http://petermasek.tripod.com/viking.html .
Not only can it eliminate the vertical missing lines, it also removes some white speckles that appear in some VO images and performs contrast stretch. But the software can only process one image at a time, which makes it extremely inconvenient.
I would love IMG2PNG to include some of these features of this software(if possible)!
Attached thumbnail(s)
Attached Image
Attached Image
Attached Image
Attached Image

 
Go to the top of the page
 
+Quote Post
jhagen
post Jul 3 2017, 07:12 PM
Post #118


Newbie
*

Group: Members
Posts: 14
Joined: 7-August 12
From: California
Member No.: 6489



QUOTE (scalbers @ Dec 3 2016, 03:48 PM) *
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?



I've struggled with converting IMG files on my MAC, too. In the course of my experimenting with HiRise files, I stumbled on the fact that I can load IMG files directly into FITS Liberator. For anyone not familiar with it, this is readily available freeware. I have been using it for years to do initial histogram stretch on my astro-photography FITS files. Turns out it does what I need for IMG conversion very smoothly. I convert the fairly large HiRise 32 bit DTM files into 16 or 32 bit TIF files to work with in other software. FITS Liberator has a variety of non-linear histogram stretch options. For DTMs I do a linear stretch using the black and white point samplers.

I'm not sure that this meets the needs folks are mentioning here, but it might be worth a try.
Go to the top of the page
 
+Quote Post
Bjorn Jonsson
post Apr 4 2018, 10:06 PM
Post #119


IMG to PNG GOD
****

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



A new version of IMG2PNG is now available. This is a minor update that simplifies the conversion of IMG files containing JIRAM images and fixes a bug that could appear when converting floating point IMG files containing DEMs in particular.

IMG2PNG is available here:

http://bjj.mmedia.is/utils/img2png/index.html
Go to the top of the page
 
+Quote Post
Bjorn Jonsson
post Mar 21 2020, 04:09 PM
Post #120


IMG to PNG GOD
****

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



This may be a strange time to announce a new version of IMG2PNG but nevertheless: A new version of IMG2PNG is now available. By far the biggest change is that IMG2PNG is now a 64 bit application - earlier versions were 32 bits. This change was necessary to make it possible to convert extremely big images, an example is 46080 x 23040 pixel LRO DEMs.

In addition to the change to 64 bits I fixed a bug that occurred in some cases when converting LROC images. In some cases information on whether to flip the output image wasn't correctly read from the LROC index files.

As usual, IMG2PNG is available here:

http://bjj.mmedia.is/utils/img2png/index.html

The 64 bit version is now the 'official' IMG2PNG version but a 32 bit version is still available (direct download: http://bjj.mmedia.is/utils/img2png/img2png_exe_32bit.zip ) for users with a 32 bit version of Windows. However, I suspect most IMG2PNG users are running a 64 bit Windows version.
Go to the top of the page
 
+Quote Post

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

 



RSS Lo-Fi Version Time is now: 19th March 2024 - 02:08 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 funded by the Planetary Society. Please consider supporting our work and many other projects by donating to the Society or becoming a member.