Christopher Myers asks:
| OK, I've read and reread the archives, googled for a while, and I still
| don't have an answer that really works.
|
| Can someone please tell me how to convert a .ps to a .gif?
|
| I'm running RedHat Linux 7.1, which of course has gs installed.

Here's the script that I use.  Note that it takes a list of  ps  file
names  on  the  command line, with or without the .ps suffix, or with
.eps as a suffix, and produces the corresponding .gif  file.   You'll
want to experiment with the resulution.

This also calls pnmcrop and ppmtogif,  but  you  probably  have  them
installed, too.  And the LD_LIBRARY_PATH may need changing.


#!/usr/bin/perl -w
#
# ps2gif [resolution] file...
#
# Convert  a postscript file to GIF, using the gs (GhostScript) command.  The
# resolution defaults to  100,  which  is  a  readable  compromise  for  most
# screens.   The files should be postscript files.  You can omit a .ps suffix
# and we'll assume it.
#
# Author: John Chambers <[EMAIL PROTECTED]>

$ENV{LD_LIBRARY_PATH} = '/usr/X11R6/lib/:/usr/eecs/lib:/usr/lib:/usr/lib/aout';

if (($R = $ARGV[0]) =~ /^\d+$/) {shift @ARGV} else {$R = 85}

file: for $f (@ARGV) {
        if ($f =~ /(.*)\.(\w*ps)$/i) {
                $F = $f;
                $G = "$1.gif";
        } else {
                if      (-f ($F = "$f.ps" )) {$G = "$f.gif";
                } elsif (-f ($F = "$f.eps")) {$G = "$f.gif";
                } elsif (-f ($F = "$f.PS" )) {$G = "$f.GIF";
                } else {
                        print STDERR "Can't find postscript file for $f.\n";
                        next file;
                }
        }
        system "gs -q -DNOPAUSE -sDEVICE=ppmraw -r$R -sOutputFile='|pnmcrop|ppmtogif 
-interlace >$G' -- $F";
}
To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html

Reply via email to