//import org.im4java.core.ConvertCmd;
//import org.im4java.core.IMOperation;
/**
* 使用gmgraphicemagic 进行图片变换大小调用
*
* @param srcPath
* @param destPath
* @param img
* @throws Exception
*/
public static void gmAlterImg(String srcPath, String destPath, int width, int height)
throws Exception {
try {
System.out.println("源文件路径-----------------------------------------" + srcPath);
System.out.println("目标文件路径----------------------------------------" + destPath);
System.out.println("目标文件宽------------------------------------------" + width);
System.out.println("目标文件高------------------------------------------" + height);
IMOperation op = new IMOperation();
op.addImage(srcPath);
op.resize(width, height);
op.addImage(destPath);
ConvertCmd convert = new ConvertCmd(true);
convert.run(op);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
此段代码需要安装GraphicsMagick Display软件