Remote Sensing Tools

Control over reality.™

IKONOS 4,3,2 false-color composite, converted to pseudo natural-color using the CIR to Naturaltone plug-in. Image courtesy of GeoEye.

Geotiff & Photoshop, Part 1

March 16th, 2007 · 8 Comments · Trackback/Ping · Share This

The Geotiff (or GeoTIFF) format, is a TIFF image that has special geospatial metadata tags in the header. Unfortunately, most industry standard image processing, manipulation programs and readers do not natively support geospatial metadata in TIFF images. Such examples are Photoshop®, and other similar programs. What can we do then in order to work with Geotiff images in Photoshop and other image editing tools that do not support Geotiff?

We have a number of options, which will be presented in a four part series:

  1. Use the listgeo and geotifcp commandline utilities provided by the developers of Geotiff.
  2. Use a standard interface that utilizes a Windows GUI to run those utilities without having to use the commandline.
    (Currently not an option for Mac users.)
  3. Use a program that is designed to read Geotiff images and export geospatial coordinate tags, projection tags, or in some cases Geotiff tags, prior to importing.
  4. Use a plugin that is specifically designed to work with geospatial imagery within the Photoshop environment.

All solutions provide anyone the capability to work with Geotiff images in Photoshop, and it depends on what capabilities and software you have present — as well as your actual needs. The following will show you how you can use any of the four options, so that you can then work with or edit your Geotiff images in Photoshop or similar tools.

Prerequisites

First, you’ll need a Geotiff image that you can use to test the methods in this tutorial. If you don’t have a Geotiff image, a sample image is provided here.:
Compressed Zip Package Sample Geotiff (~350 KB download, .zip package)

listgeo and geotifcp

First, you should have the commandline utilities provided by the Geotiff site. You can download these programs from the primary site here.:
http://www.remotesensing.org/geotiff/

Scroll down to the sub-section titled libgeotiff, and you’ll see links to locations where the utilities are provided for download. The file that you specifically need, for Windows systems, is the following — and I’ll link it here for your convenience (and because it’s sometimes confused with the other packages, which are development release packages).:
Compressed Zip Package listgeo-geotifcp-win32-x86-112502.zip

For Mac OS 10.x users, you’ll want to download the following file.:
Compressed Zip Package geotiff-bin-114-macos10.1.tar.gz
(Mac binaries are provided in the bin folder.)

Now that you have the necessary utilities, you’ll need to place them in a location so that you can run them through your command prompt. This location is up to you, whether you feel comfortable in placing them in your root system directory, or whether you wish to create a specific directory and call their use in the commandline with a path.

Let’s assume that you’ve placed these utilities in a specific directory folder located on your C: drive, and you gave this folder a special name. In this example, we’ll use the foldername: geotools

Copy and paste, or just drag and drop the binary listgeo.exe and geotifcp.exe utilities into this folder. You now have a specific location that you’ll send commands to using the command prompt when needed.

Usage - listgeo

We’re going to start out by using listgeo, which reads the Geotiff metadata header, or keys, and allows us to write this to a human readable text file that can be stored and retrieved. This is a crucial step in preventing metadata from becoming lost or overwritten, prior to importing and editing an image in an image editor that doesn’t support Geotiff.

Commandline usage for listgeo.exe is rather simple. We’ll just need to know the path to the listgeo utility, and the path to the Geotiff file we wish to strip the metadata from. As a generic example, you’ll type something similar to the following into your command prompt (replacing the paths with your paths, and all on one line as the demonstration code here wraps on this page):

C:\geotools\listgeo D:\samples\sample_geotiff.tif > D:\samples\sample_geotiff.gtf

What did we do here? If everything worked right, you should have seen a file with the .gtf extension in the same folder as your image. You can open this file in a text editor, such as Notepad, to view the Geotiff metadata keys that were dumped. The following is what you told listgeo to do:

  • path_to\listgeo (call the listgeo program)
  • path_to\sample_geotiff.tif (the Geotiff file)
  • > (output to…)
  • path_to\sample_geotiff.gtf (Geotiff tags file)

Now we can load and edit the remaining Geotiff image in Photoshop or any other image manipulation program, ensuring that we have the appropriate metadata back-up in text format. In fact, you can see what happens in a program like Photoshop, by simply loading the sample_geotiff.tif image — and saving it as a .tif as you normally would. Now, if you run the listgeo program on the image that was saved out of Photoshop, you’ll see that the Geotiff metadata tags were not saved with the image!

(If you somehow find that you’ve lost the text file and you lost the Geotiff file due to saving out of Photoshop, don’t worry. You can always download the sample file above to start over.)

Usage - geotifcp

Now, onto using geotifcp. The geotifcp utility allows us to take the image that we just saved out of Photoshop, which lost its Geotiff metadata header, and re-incorporate, or re-stuff the metadata from the text file back into the image.

Once again, the usage is similar to listgeo, but slightly different as it’s basically in reverse order and with a specific function. Again, you’ll type something similar to the following in your prompt, as a generic example. (All on one line.):

C:\geotools\geotifcp -g D:\samples\sample_geotiff.gtf D:\samples\sample_geotiff.tif D:\samples\sample_geotiff_gf.tif

What did we do here? If everything worked correctly, then you should have seen a second image appear in your folder with the additional ammendment of _gf in the filname. What you told geotifcp to do, is the following:

  • path_to\geotifcp (call the geotifcp program)
  • -g (install Geotiff metadata from file)
  • path_to\sample_geotiff.gtf (the metadata text file)
  • path_to\sample_geotiff.tif (the .tif file saved from Photoshop)
  • path_to\sample_geotiff_gf.tif (output your new Geotiff file)

Commandline vs. GUI

For many users who aren’t entirely comfortable with using the commandline, this is a typical concern. Most of us are taught or learned to use a computer through the standard GUI options by point and clicking the interfaces of the OS and the programs that we use. However, in the geospatial industry there are many cases involving the use of the commandline, and you’ll appreciate any time you’ve been willing to take to familiarize yourself with running these programs. Many valueable tools exist that require the use of the command prompt — and in some cases, are an only option.

Caveats

Using listgeo and geotifcp with a tool like Photoshop does come with some consideration in mind. The utilities themselves perform specific functions — either dump the metadata to a text file, or re-stuff metadata from a text file into an image. This is an important thing to consider due to the following:

  • If you were to alter the image size in any way when editing in Photoshop, then it’ll require some editing in the metadata. I don’t recommend this because a variety of problems can be associated.
  • If you were to crop the image in Photoshop, then the metadata’s coordinates are no longer valid to the pixels of the image.

In fact, I don’t recommend re-sizing or cropping of any kind if this is your only method. It’s always better practice to be safe than sorry when it comes to geospatial imagery.

More to come…

Geotiff & Photoshop, Part 2 will explore the second option, which is how to use a simple interface designed to do what was explained in this tutorial. It was contributed to the geospatial community by GeoSage, developers of the HighView advanced pan-sharpening and image fusion program.

For More Information

For more information using the listgeo and geotifcp commandline utilities, do so by exploring the documents provided at the primary Geotiff Web site, which provides a list of the additional functions and options that these utilities provide.: http://www.remotesensing.org/geotiff/

Categories: Formats · Software · Tutorials
Tags: , , , , , ,

Advertisement

8 responses so far ↓

  • 1 Cody Benkelman Mar 26, 2007 at 8:58 am

    An excellent overview that should be of great value to a lot of people.

    Thanks for building this!

    Cody Benkelman

  • 2 kahfie abilowo Mar 28, 2007 at 11:43 am

    I’m relieved to have found this tutorial. Helped me a lot. Thanks.

  • 3 Daniel Gray Apr 5, 2007 at 10:46 am

    I am curious about clipping a geotiff in photoshop, the tutorial above dosent mention if you can do this in photoshop or not and still re-assign the the coordinates properly.

    -Daniel

  • 4 Daniel Apr 5, 2007 at 11:01 am

    Daniel,

    There is a tutorial at 3DNnature.com that provides a reference to manually crop Geotiff images using Photoshop and Geotiff Examiner here:
    http://3dnature.com/tutorials/NLCD/NLCD4_body.htm

    Keep in mind that I will not recommend cropping geospatial imagery in Photoshop without the proper plugin installed to handle the actual calculations.

    You can also crop imagery through the commandline using the GDAL_translate utility, which you can locate through Maptools.org, or if you have Open_EV or FW_Tools installed (which installs the GDAL commandline tools with the package). The calculations would be more appropriate using this manual method instead.

  • 5 Adnan Khan Jun 21, 2007 at 5:16 am

    VERY VERY Helpful review… Had a look at Geographic Imager plugin but its too expensive. I think using GDAL is the best option here.

  • 6 mounir Mar 5, 2008 at 8:24 am

    when i execute the command line listgeo the result is shown on the Ms-Dos window and not saved in gtf file.please show me how can I resolve this problem?

  • 7 Daniel Mar 8, 2008 at 4:19 pm

    Mounir,

    You would have to describe exactly what you did for the instructions I outline above not to work. If you follow the directions closely, you should have no problems parsing the metadata from a Geotiff file and vice versa.

  • 8 mounir Mar 22, 2008 at 4:13 pm

    thx for answer
    I have made an error when writing the ligne command i forgot to add the operator >
    so the command ligne didn’t work properly

Respond to “Geotiff & Photoshop, Part 1”