user2118784
user2118784

Reputation: 452

unable to execute compare command of ImageMagick from Java im4java

I am using Eclipse JUNO JDK 7 im4java-1.4.0

When I execute the Java progrm I am facing the below problem

org.im4java.core.CommandException: org.im4java.core.CommandException: compare.exe

My Code is:

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();
    }
}

Please suggest me. Thanks in advance.

Upvotes: 2

Views: 647

Answers (1)

user2118784
user2118784

Reputation: 452

Adding path of ImageMagick into PATH variable. as well as

CompareCmd compareCmd = new CompareCmd();
compareCmd.setSearchPath("D:/ImageMagick-6.8.5-Q16");

Upvotes: 1

Related Questions