[Gdal-dev] pct2rgb.py

Dobmeyer, Todd tdobmeye at ball.com
Thu Oct 14 13:59:00 EDT 2004


I honestly do not remember how I built gdal, if I did it with python
support or not. I might rebuild this to make sure that I do add python
support. I am on Windows XP Pro and am very new to gdal yet. To make
sure I get python support, I should go out and find one of the OpenEV_FW
builds? Or what exactly should I do? Thanks for your continued help and
I am glad I chose to work with gdal!

Todd Dobmeyer

-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com] 
Sent: Thursday, October 14, 2004 1:51 PM
To: Dobmeyer, Todd
Cc: gdal-dev at xserve.flids.com
Subject: Re: [Gdal-dev] pct2rgb.py

Dobmeyer, Todd wrote:
> I am trying to take my red, blue, and green geotiff files and turn
them 
> into one tif file. I assume I need to use pct2rgb.py to do this. I
went 
> and downloaded python 2.3.4 and loaded up pct2rgb.py. When I tell it
to 
> RUN, in the shell, it complains that in the file gdal.py it cannot
find 
> the module named _gdal. Am I not running this correctly in python, or 
> why is this not running correctly? Thanks for your help!

Todd,

I'm not sure how you built your GDAL.  Was it built with python support
enabled?  You also didn't mention what platform you are on.  If you are
on windows or Linux you could just use one of the recent OpenEV_FW
builds
which include python and with all paths and environment variables setup
properly.

All that said, if you have red, green and blue bands in seperate files
and you want to merge them into a single multi-band file you don't want
pct2rgb.py anyways.  pct2rgb.py is for making a 24bit RGB image from an
8 bit image with a color table (pct == pseudo-color table in my lingo).

What you want to do can be accomplished with gdal_merge.py like this:

   gdal_merge.py -o rgb.tif red.tif green.tif blue.tif -seperate

The "-seperate" flag indicates that each file should be placed
in a different band.  Of course, this is a python script too, so you
will
need to resolve your python issues.

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 Gdal-dev mailing list