~ubuntu-branches/ubuntu/trusty/geda-utils/trusty

« back to all changes in this revision

Viewing changes to scripts/gpstoimage

  • Committer: Bazaar Package Importer
  • Author(s): Hamish Moffatt
  • Date: 2005-03-15 23:04:53 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050315230453-x3x6qtw9qv17zbnf
Tags: 20050313-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# gEDA: GNU Electronic Design Automation
 
4
# pstoimage (converts a postscript file to a gif)
 
5
# This script is placed under the GNU Public License (GPL) version 2.0 
 
6
 
 
7
# This scripts creates gifs from ps files using gs and ppmtogif
 
8
# (both programs are REQUIRED)
 
9
 
 
10
# It's a fairly simple script designed to give an idea on how to take
 
11
# the output from gschem and create image files
 
12
 
 
13
# First parameter is the input filename (must be a postscript file)
 
14
# output filename is called `basename $1`.gif
 
15
 
 
16
# This script requires free diskspace when it runs due to ppm files being
 
17
# so large (don't forget to remove old ppms)
 
18
 
 
19
# I have found that ppmtogif does a poor job sometimes, so it in that case
 
20
# try using xv to read the image and then save it as a gif
 
21
 
 
22
 
 
23
if [ "$1" = "" ] 
 
24
then 
 
25
        echo usage: pstoimage filename.ps
 
26
        exit 0
 
27
fi
 
28
 
 
29
input_filename=$1
 
30
basename=`basename $input_filename .ps`
 
31
output_filename=${basename}.gif
 
32
#resolution=100
 
33
 
 
34
 
 
35
# Added a -r${resolution} if you want to control the resolution
 
36
#
 
37
 
 
38
# Uncomment the following line if you have Aladdin Ghostscript 
 
39
# and want anti-aliasing enabled (replace this line with the other gs line
 
40
#gs -r200 -q \
 
41
gs -q -dTextAlphaBits=4 -dGraphicsAlphaBits=4 \
 
42
        -dNOPAUSE -sOutputFile=$basename.ppm \
 
43
        -sDEVICE=ppm \
 
44
        $input_filename quit.ps
 
45
 
 
46
# ppm to gif
 
47
ppmtogif $basename.ppm > $output_filename 
 
48
 
 
49
#
 
50
# Use ImageMagic convert if you want crop the image
 
51
# This will create fairly big gif files
 
52
#convert -crop 0x0 $output_filename ${basename}_crop.gif
 
53