1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-06-26 01:19:48 +03:00

eda-tools/fab/gerb2pbm: convert a Gerber file to a PBM image

This commit is contained in:
Werner Almesberger 2011-06-10 12:38:35 -03:00
parent 4e4849154a
commit f6b485922e

46
fab/gerb2pbm Executable file
View File

@ -0,0 +1,46 @@
#!/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