Computer Programs in Seismology Tutorial

Wave propagation for ocean floor observations

DOPLTPNG

This script converts the CPS graphics PLT files to a PNG image using the ImageMagick convert tool. To use this enter a command like

DOPLTPNG PRS001.PLT

which will create a file with the name PRS001.png.

The comments are given in the color red.

#!/bin/sh

if [ $# -eq 0 ]
then
   echo "Usage:  DOPLTPNG CPS_plot_files "  # If no files are given on the 
   echo "   as in "                         # command line, print the  
   echo "   DOPLTPNG PRS001.PLT"            # command syntax.
   exit 0
fi

for i 
do
B=`basename $i .PLT`                                                     
plotnps -F7 -W10 -EPS -K < $i > t.eps                               
convert -trim t.eps -background white -alpha remove -alpha off ${B}.png  
rm t.eps                                                                
done
#For each file on the command line, strip off the .PLT
#Convert to an EPS with color
#Use ImageMagick to force non-transparency and convert to png 
#and then clean up