window下与linux下安装Imagemagick

下载 ImageMagick
官方网址是: www.imagemagick.org
sourceforge的下载地址: imagemagick.sourceforge.net

 

linux下的ImageMagick安装方法。

1、解压并安装

./configure –prefix=/usr/local/imagemagick –enable-lzw –with-modules && make && make install


基本上这样就可以了。
默认的就支持jpeg,png等图片
你也可以加入–without-xxx来禁止一些选项,具体的就./configure –help | grep without吧。

编译等待时间可能会比较漫长。


2、测试

/usr/local/imagemagick/bin/convert -quality 90 -resize 100×100 /tmp/origine_image.jpg /tmp/small_100_100.jpg

命令释义:将/tmp目录下的origine_image.jpg图片重新缩放成100×100的大小保存在/tmp目录下文件名为small_100_100.jpg,图片质量为90。

具体更多的,用的时候就知道了,还可以用php把imagemagick编辑成为php的模块

 

3、设置环境变量:

修改/etc/profile

LD_LIBRARY_PATH=/usr/local/lib:/usr/local/imagemagick

export LD_LIBRARY_PATH

修改/etc/ld.so.conf加入

 

 

window下的ImageMagick安装方法。

1、解压安装

 

2、在config.xml里面配置工具的路径,指定到安装目录的convert.exe文件

 

3、String[] cmd = new String[5];
            cmd[0] = imageMagickTool.getAbsolutePath();
            cmd[1] = "-thumbnail" ;
            cmd[2] = imgSize;
            cmd[3] = src.getAbsolutePath();
            cmd[4] = dest.getAbsolutePath();
            Runtime rt = Runtime.getRuntime();
            Process proc = rt.exec(cmd);
            exitValue = proc.waitFor();

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值