Root/fab/gerb2pbm

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
15COPPER="(cons 'color #(65535 50401 10000))"
16PASTE="(cons 'color #(39083 39083 50000))"
17MASK="(cons 'inverted #t) (cons 'color #(8839 53994 8178))"
18SILK="(cons 'color #(65535 65535 65535))"
19EDGE="(cons 'color #(65535 65535 0))"
20DRILL="(cons 'color #(0 0 40000))"
21
22FRONT="(cons 'color #(65535 10000 10000))"
23BACK="(cons 'color #(30000 65535 30000))"
24EDGE2="(cons 'color #(30000 40000 65535))"
25
26
27usage()
28{
29    cat <<EOF 1>&2
30usage: $0 gerber-file pbm-file
31EOF
32    exit 1
33}
34
35
36[ ! "$2" -o "$3" ] && usage
37
38cat <<EOF >_gvp
39(define-layer! 1
40  (cons 'filename "$1")
41  (cons 'color #(65535 65535 65535)))
42(set-render-type! 2)
43EOF
44gerbv -p _gvp --dpi=600 -x png -o _png
45pngtopnm _png | ppmtopgm | pgmtopbm -threshold >"$2"
46rm -f _gvp _png
47

Archive Download this file

Branches:
master



interactive