首页 > 代码库 > MAC中用ImageMagick转换图像

MAC中用ImageMagick转换图像

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


本文出自 “GONE WITH THE WIND” 博客,请务必保留此出处http://h2appy.blog.51cto.com/609721/1567918

MAC中用ImageMagick转换图像