我正在使用Eclipse JUNOJDK 7im4java-1.4.0
当我执行Java程序时,我面临以下问题
org.im4java.core.CommandException: org.im4java.core.CommandException: compare.exe
我的代码是:
public static void main(String[] args) {
String imPath = "D:/ImageMagick-6.8.5-Q16";
ProcessStarter.setGlobalSearchPath(imPath);
System.out.println(imPath);
File image1 = new File("src//test//one.png");
File image2 = new File("src//test//two.png");
CompareCmd compareCmd = new CompareCmd();
compareCmd.setSearchPath(imPath);
IMOperation imOperation = new IMOperation();
imOperation.metric("MAE");
imOperation.addImage(image1.getAbsolutePath());
imOperation.addImage(image2.getAbsolutePath());
try {
compareCmd.run(imOperation);
}
catch (IOException e) {
e.printStackTrace();
}
catch (InterruptedException e) {
e.printStackTrace();
}
catch (IM4JavaException e) {
e.printStackTrace();
}
}
请推荐我。提前谢谢。
将ImageMagick的路径添加到path变量中。以及
CompareCmd compareCmd = new CompareCmd();
compareCmd.setSearchPath("D:/ImageMagick-6.8.5-Q16");