HiRISE images are huge, frequently 1.5 GB, and they are in JPEG 2000 format, which many image software programs don't (yet) handle. So what do you do if you need to work with just a small area of that image at high resolution? This post explains how to get that subframe.
First, determine the region you want cropped. Go through the HiRISE image catalog to find the image you want. On the image's page, in the sidebar, under "JP2 Quicklook (IAS Viewer)" click "full image, grayscale, map projected". That link will open the IAS viewer so you can look at the image at full resolution without actually downloading the whole thing. Use the viewer to determine the upper left pixel coordinate of the region you want to keep, and the dimensions of the area you want to keep.
To do the crop, PIRL has a program called JP2_to_PDS that you can use. If you have a PIRL account you can run the software and crop the image on the PIRL systems. Otherwise you need to download and install the free program on your local computer, and you also need to download the full image to your computer (JP2 Products, Download, in the sidebar.)
Whether you use the PIRL system or do this locally, run JP2_to_PDS using the -Area flag to crop the image and output a PDS .IMG file. JP2_to_PDS -Help will describe the usage of the various flags. Then use PDS_to_JP2 to convert the cropped .IMG file back to a JP2. For example:
% JP2_to_PDS -Area 10400,4500,5000,5000 PSP_001513_1655_RED.JP2
% PDS_to_JP2 PSP_001513_1655_RED.IMG -Output PSP_001513_1655_RED.crop.JP2
Now you have a cropped JP2 image, but analysis programs like ImageJ still can't handle JP2. To convert the JP2 to a regular JPG, you can use a current version of ImageMagick that supports JP2 images. Empirically, JP2 support seems to be present in version 6.3.2 but not 6.3.0. To check whether your version supports JP2, run "identify -list format". With ImageMagick installed, the convert command is "convert -quality 100 image.jp2 image.jpg" to get a full resolution jpg.
Comments
gdal
You could try GDAL (http://fwtools.maptools.org/) for converting JP2 files. Its fast!
My hope is that the JPIP protocol to stream large JP2 files is implemented in more and more software. I understand there is an effort underway to support JPIP in GDAL. If so this means its easier to write a plugin for ArcGIS f.e.
Cheers, Jelmer
Thanks for the nice tutorial
Thanks for the nice tutorial on cropping images with high resolution.
Regards
xtgate.com