1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-27 04:38:26 +02:00
eda-tools/fab/gerb2pbm

47 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/bin/sh
#
# gerb2pbm - Convert a single Gerber file to a Portable BitMap image
#
# Written 2011 by Werner Almesberger
# Copyright 2011 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.
#
COPPER="(cons 'color #(65535 50401 10000))"
PASTE="(cons 'color #(39083 39083 50000))"
MASK="(cons 'inverted #t) (cons 'color #(8839 53994 8178))"
SILK="(cons 'color #(65535 65535 65535))"
EDGE="(cons 'color #(65535 65535 0))"
DRILL="(cons 'color #(0 0 40000))"
FRONT="(cons 'color #(65535 10000 10000))"
BACK="(cons 'color #(30000 65535 30000))"
EDGE2="(cons 'color #(30000 40000 65535))"
usage()
{
cat <<EOF 1>&2
usage: $0 gerber-file pbm-file
EOF
exit 1
}
[ ! "$2" -o "$3" ] && usage
cat <<EOF >_gvp
(define-layer! 1
(cons 'filename "$1")
(cons 'color #(65535 65535 65535)))
(set-render-type! 2)
EOF
gerbv -p _gvp --dpi=600 -x png -o _png
pngtopnm _png | ppmtopgm | pgmtopbm -threshold >"$2"
rm -f _gvp _png