Root/
| 1 | #!/bin/sh |
| 2 | # |
| 3 | # gerb2pbm - Convert a single Gerber file to a Portable BitMap image |
| 4 | # |
| 5 | # Written 2011 by Werner Almesberger |
| 6 | # Copyright 2011 Werner Almesberger |
| 7 | # |
| 8 | # This program is free software; you can redistribute it and/or modify |
| 9 | # it under the terms of the GNU General Public License as published by |
| 10 | # the Free Software Foundation; either version 2 of the License, or |
| 11 | # (at your option) any later version. |
| 12 | # |
| 13 | |
| 14 | |
| 15 | COPPER="(cons 'color #(65535 50401 10000))" |
| 16 | PASTE="(cons 'color #(39083 39083 50000))" |
| 17 | MASK="(cons 'inverted #t) (cons 'color #(8839 53994 8178))" |
| 18 | SILK="(cons 'color #(65535 65535 65535))" |
| 19 | EDGE="(cons 'color #(65535 65535 0))" |
| 20 | DRILL="(cons 'color #(0 0 40000))" |
| 21 | |
| 22 | FRONT="(cons 'color #(65535 10000 10000))" |
| 23 | BACK="(cons 'color #(30000 65535 30000))" |
| 24 | EDGE2="(cons 'color #(30000 40000 65535))" |
| 25 | |
| 26 | |
| 27 | usage() |
| 28 | { |
| 29 | cat <<EOF 1>&2 |
| 30 | usage: $0 gerber-file pbm-file |
| 31 | EOF |
| 32 | exit 1 |
| 33 | } |
| 34 | |
| 35 | |
| 36 | [ ! "$2" -o "$3" ] && usage |
| 37 | |
| 38 | cat <<EOF >_gvp |
| 39 | (define-layer! 1 |
| 40 | (cons 'filename "$1") |
| 41 | (cons 'color #(65535 65535 65535))) |
| 42 | (set-render-type! 2) |
| 43 | EOF |
| 44 | gerbv -p _gvp --dpi=600 -x png -o _png |
| 45 | pngtopnm _png | ppmtopgm | pgmtopbm -threshold >"$2" |
| 46 | rm -f _gvp _png |
| 47 |
Branches:
master
