-
Notifications
You must be signed in to change notification settings - Fork 0
ImageMagick
Masato Ikeda edited this page Jul 20, 2013
·
1 revision
imagemagickタグの記事を適宜まとめた。
JPEG、PNG、TIFF、PDFの変換ができるようにする。そのままだとAdobe系のツールで生成されたPDFとGhostscriptのデフォルトのDEVICEの相性が悪いらしいので、delegates.xmlにパッチをあてる。
$ brew install libjpeg
$ brew install libpng
$ brew install libtiff
$ brew install lcms2
$ brew install ghostscript
$ brew install imagemagick --with-ghostscript --with-libtiff --with-little-cms
$ cd /usr/local/opt/imagemagick/etc/ImageMagick
$ cp delegates.xml delegates.xml.org
$ vim delegates.xml
$ diff -u delegates.xml.org delegates.xml
--- delegates.xml.org 2013-05-28 20:14:47.000000000 +0900
+++ delegates.xml 2013-05-28 20:11:30.000000000 +0900
@@ -102,7 +102,7 @@
<delegate decode="ps" encode="eps" mode="bi" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=epswrite" "-sOutputFile=%o" "-f%i""/>
<delegate decode="ps" encode="pdf" mode="bi" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pdfwrite" "-sOutputFile=%o" "-f%i""/>
<delegate decode="ps" encode="print" mode="encode" command="lpr "%i""/>
- <delegate decode="ps:alpha" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>
+ <delegate decode="ps:alpha" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pnmraw" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>
<delegate decode="ps:cmyk" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pam" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>
<delegate decode="ps:color" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pnmraw" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>
<delegate decode="ps:mono" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pbmraw" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>
なおこのパッチはgistにも上げているので、次のコマンドで適用できる。
$ cd /usr/local/opt/imagemagick/etc/ImageMagick
$ curl https://gist.github.com/a2ikm/5662166/raw/e2b5907d0bd88796fbcf286a752607a7511d01f3/delegates.xml.diff | patch -u