[Geotiff] How to transparent the background Geotiff image

Frank Warmerdam warmerdam at pobox.com
Sat Sep 25 11:18:08 EDT 2004


Norsidah Taib wrote:
> Hi there,
> I would like to ask about how to make the background image appear as transparent without changes
> the value of the image (coordinate).My image is the geotiff raster image(the image with the
> coordinate). I get that image using ERDAS Imagine which is *.img file, then i import to *.geotiff.
> I have set the background as transparent but when it displayed,the background color is white. Can
> I do the transparent function as in adobe photoshop?,because i afraid that the image's coordinate
> would loss.Is there any program that can do the transparency function on geotiff image like
> photoshop?
> 
> Currently, I develop a program that display the geotiff image. I use visual basic and map
> object(from esri).
> Thank you for spending your time read my email.Hope to hear from you soon. Thank you so much.

Norsidah,

First, if you work on a GeoTIFF file in photoshop and then export to a new
TIFF file the georeferencing tags will be lost.  This will be true of essentially
all applications which are not geotiff aware.

Second, the issues about transparency aren't *really* appropriate for this
list and will depend alot on what applications you are working with.

Third, if you use some non-geotiff aware application to modify your TIFF
file, you can "reapply" the georeferencing tags using listgeo and geotifcp.
This would work something like:

   listgeo original_geotiff.tif > geotiff.metadata

   <manipulate original_geotiff.tif into tiff_from_photoshop.tif using photoshop>

   geotifcp -g geotiff.metadata tiff_from_photoshop.tif new_geotiff.tif

Note this only makes sense if the image is still of the same area.  That,
is, if you use photoshop to resize or cutdown the image you won't be able
to correctly apply the old geotiff metadata.  But if you are just doing
something like adding a transparency band you will be fine.

I can't speak to whether the ESRI software will honour transparency when
operating on a TIFF file. You might want to do a quick test with a file
produced in photoshop and display via the appropriate ESRI component before
trying to work out the rest of the process.   I would hope it would be
sufficient to have a TIFF file with 1 extra sample marked properly as
associated alpha.

I get the impression that you "set the background transparent" in Imagine
and then you exported the image to GeoTIFF with Imagine.  Note that TIFF
does not support a "transparent value" or "nodata value" in a standard way.
The way transparency is implemented in TIFF normally is to provide a whole
"alpha" band.  I doubt that Imagine is doing this.

Finally, it would likely be possible to write an EML script for Imagine
that *would* produce a transparency band and derive it from some concept
of background presumably based on nodata values and then export it correctly
to GeoTIFF.  However, I don't know anywhere near enough to do this.  I could
implement such a script in Python using my GDAL library but it would not be
trivial.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Geotiff mailing list