Last active
November 29, 2019 04:12
-
-
Save sawa2d2/6402e70efeac3824033a5420515cc079 to your computer and use it in GitHub Desktop.
vector-image-convertor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM debian:stretch | |
| SHELL ["/bin/bash", "-c"] | |
| RUN apt-get update \ | |
| && apt-get install -y wget gcc make inkscape \ | |
| && wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs927/ghostscript-9.27.tar.gz \ | |
| && cd ghostscript-9.27 \ | |
| && ./configure --disable-fileinfo \ | |
| && make -j1 \ | |
| && su \ | |
| && make install | |
| # && apt install -y texlive-font-utils # FOR epstopsd AND eps2epsi (https://packages.debian.org/stretch/tex/texlive-font-utils) | |
| # COPY vector-image-convertor.sh / | |
| # ENTRYPOINT ["/vector-image-convertor.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SVG=$(echo $1) | |
| FILENAME=$(echo "$SVG" | sed 's/\.[^\.]*$//') | |
| cairosvg "$SVG" -o "${FILENAME}.pdf" # SVG to PDF | |
| pdf2ps "${FILENAME}.pdf" "${FILENAME}.eps" # PDF to EPS | |
| inkscape "${FILENAME}.pdf" -M "${FILENAME}.emf" # PDF to EMF | |
| rm "${FILENAME}.pdf" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Converts all svg files in the directory to eps and emf. | |
| # Usage: $ sh svg2epsANDemfALL.sh DIRNAME | |
| \find $1 -name \*.svg | xargs -n 1 sh svg2epsANDemf.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for %%f in (%*) do ( | |
| ps2epsi %%f %%~pf%%~nf.eps | |
| epstopdf %%~pf%%~nf.eps %%~pf%%~nf.pdf | |
| pdftocairo -svg %%~pf%%~nf.pdf | |
| "C:\Program Files\Inkscape\inkscape.com" -z -f %%~pf%%~nf.svg -M %%~pf%%~nf.emf | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment