[mapserver-users] Preparing tif images

Scott Phillips scott at esrp.csustan.edu
Fri Nov 16 16:50:23 EST 2001


To change to 8-bit pallete in Paint Shop, use Colors->Reduce Color Depth to 
reduce the colors to 256 colors (makes 8 bit palleted image).   It lets you 
choose from a few methods (Median Cut, Octree, Standard).  You can try each 
out to see what gives the best results, Octree usually works good for the 
images I've converted.

Also, if you have many images you could use ImageMagick, a program with 
command tools you could use to do a bunch of images in batch.

I think the command line for this is something like:
convert -colors 255 [ORIGINAL IMAGE] [NEW IMAGE]
or
convert -antialias -colors 255 [ORIGINAL IMAGE] [NEW IMAGE]

You can make a batch file like:
----------------------------------------------------
REM colordepth.bat - reduces the color depth
convert -colors 255 %1 %2
----------------------------------------------------

Then run a second batch file like:
----------------------------------------------------
REM runs colordepth.bat for a bunch of files

call colordepth.bat foo1.tif foo1b.tif
call colordepth.bat foo2.tif foo2b.tif
call colordepth.bat foo3.tif foo3b.tif
----------------------------------------------------

This method can be a time saver if you are working on a large set of files.

Also, neither program keeps the GeoTIFF tags, so you need to make sure you 
save or create a World File for these.

If they are GeoTIFF and don't have world files, you can use the "geotifcp" 
program that comes with the GeoTIFF library to make them:

geotifcp -TFW foo.tif
(this reads Geotiff file foo.tif and makes a new World file called foo.tfw)

Once you have the world file from the original image, you can just rename it 
to match your new 8-bit image.

- Scott




More information about the mapserver-users mailing list