mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2025-04-21 12:27:27 +03:00
Split gitsch2ppm into its constituents.
- scripts/gitsch2ps: generate PS files for KiCad schematics in git - scripts/normalizeschps: normalize eeschema Postscript - scripts/schps2ppm: generate PPM files from normalized Eeschema Postscript - scripts/gitsch2ppm: wrapper and cache manager for the above scripts
This commit is contained in:
53
scripts/schps2ppm
Executable file
53
scripts/schps2ppm
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# schps2ppm - Generate PPM files from normalized Eeschema Postscript
|
||||
#
|
||||
# Written 2010 by Werner Almesberger
|
||||
# Copyright 2010 Werner Almesberger
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
|
||||
|
||||
RES=1280x850
|
||||
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF 1>&2
|
||||
usage: $0 [options] [file.ps [file.ppm]]
|
||||
|
||||
-r XxY image resolution (default: $RES)
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-r) [ -z "$2" ] && usage
|
||||
RES="$2"
|
||||
shift 2;;
|
||||
-*)
|
||||
usage;;
|
||||
*)
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ ! -z "$3" ] && usage
|
||||
in=${1:--}
|
||||
out=${2:-/dev/stdout}
|
||||
|
||||
X=`echo $RES | sed 's/x.*//'`
|
||||
Y=`echo $RES | sed 's/.*x//'`
|
||||
IRES=${Y}x$X
|
||||
res=`expr 72 \* $X / 800`
|
||||
|
||||
cat "$in" |
|
||||
gs -sDEVICE=ppmraw -sOutputFile=- -g$IRES -r$res \
|
||||
-dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q - |
|
||||
pnmflip -r270 >"$out"
|
||||
Reference in New Issue
Block a user