Wikipedia:WikiProject Electronics/Ps2svg.sh

From Wikipedia, the free encyclopedia
Jump to: navigation, search
#!/bin/sh -e
# you need gs-common, pstoedit and skencil to
# get this script working
BASENAME=$(basename "$1"; echo x) BASENAME=${BASENAME%x}

# Outline fonts
eps2eps -dNOCACHE "$1" "${BASENAME}".ps2svg.ps

# Fix bounding box
ps2epsi "${BASENAME}".ps2svg.ps "${BASENAME}".ps
rm "${BASENAME}".ps2svg.ps

# Convert to Sketch
pstoedit -f sk "${BASENAME}".ps "${BASENAME}".sk

# Convert to SVG
skconvert "${BASENAME}".sk "${BASENAME}".svg
# You can also make the whole thing a big long pipe and eliminate the use of tmp files.