MAC中用ImageMagick轉換影像

餘二五發表於2017-11-15

MAC上,安裝imagemagic:

下載:

http://www.imagemagick.org/script/binary-releases.php#macosx

安裝:

Create (or choose) a directory to install the package into and change to that directory, for example:

$ cd $HOME

Next, extract the contents of the package. For example:

$ tar xvzf ImageMagick-x86_64-apple-darwin13.2.0.tar.gz

Set the MAGICK_HOME environment variable to the path where you extracted the ImageMagick files. For example:

$ export MAGICK_HOME=”$HOME/ImageMagick-6.8.9″

If the bin subdirectory of the extracted package is not already in your executable search path, add it to your PATH environment variable. For example:

$ export PATH=”$MAGICK_HOME/bin:$PATH”

Set the DYLD_LIBRARY_PATH environment variable:

$ export DYLD_LIBRARY_PATH=”$MAGICK_HOME/lib/”

Finally, to verify ImageMagick is working properly, type the following on the command line:

$ convert logo: logo.gif$ identify logo.gif$ display logo.gif


將PDF檔案轉成影像

#convert -density 150 -quality 100 -resize 800x “file.pdf” “result.jpg”

將file.pdf檔案輸出為result.jpg檔案,如果PDF有多頁,影像將自動以result-0.jpg` , `result-1.jpg`…形式輸出。



MAC上,用imagemagick把jpg轉成黑白TIFF圖的命令:

localhost:~ test$ convert 005.jpg -type bilevel -monochrome -compress group4 005.tif

localhost:~ test$ convert 005.jpg  -monochrome -compress group4 005.tif

localhost:~ test$ convert 005.jpg  -compress group4 005.tif

參考:

http://www.imagemagick.org/script/command-line-options.php

http://www.imagemagick.org/script/convert.php

http://linux.chinaunix.net/docs/2006-12-15/3481.shtml

本文轉自 h2appy  51CTO部落格,原文連結:http://blog.51cto.com/h2appy/1567918,如需轉載請自行聯絡原作者


相關文章