天天看點

MAC中用ImageMagick轉換圖像

MAC上,安裝imagemagic:

下載下傳:

<a href="http://www.imagemagick.org/script/binary-releases.php#macosx" target="_blank">http://www.imagemagick.org/script/binary-releases.php#macosx</a>

安裝:

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 <code>MAGICK_HOME</code> environment variable to the path where you extracted the ImageMagick files. For example:

$ export MAGICK_HOME="$HOME/ImageMagick-6.8.9"

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

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

Set the <code>DYLD_LIBRARY_PATH</code> 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

參考:

<a href="http://www.imagemagick.org/script/command-line-options.php" target="_blank">http://www.imagemagick.org/script/command-line-options.php</a>

<a href="http://www.imagemagick.org/script/convert.php" target="_blank">http://www.imagemagick.org/script/convert.php</a>

<a href="http://linux.chinaunix.net/docs/2006-12-15/3481.shtml" target="_blank">http://linux.chinaunix.net/docs/2006-12-15/3481.shtml</a>

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

繼續閱讀