Compare cmd class not being identified

105 views Asked by At

I am using the following code to compare 2 image files but even after downloading required dependecies/jar files CompareCmd class is not getting identified and gives compilation error.

import org.im4java.core.*
import org.im4java.process.*
import org.im4java.utils.*

boolean compareImages(String file1, String file2) {
        // This instance wraps the compare command
        CompareCmd compare = new CompareCmd() //throws compilation error here
        // For metric-output
        compare.setErrorConsumer(StandardStream.STDERR)
        IMOperation cmpOp = new IMOperation()
        // Set the compare metric
        cmpOp.metric("mae")

        // Add the expected image
        cmpOp.addImage(file1)

        // Add the current image
        cmpOp.addImage(file2)

        // This stores the difference
//                        cmpOp.addImage(diff)

        try {
            // Do the compare
            compare.run(cmpOp);
            return true
        }
        catch (Exception ex) {
            return false
        }
    }

Error: unable to resolve class CompareCmd @ line 150, column 20. CompareCmd compare = new CompareCmd() ^

Can someone tell me if this class still exists in latest version of im4Java? or am I missing something.

Thanks in advance.

0

There are 0 answers