比较未识别的cmd类

时间:2017-04-11 13:04:30

标签: java imagemagick im4java

我使用以下代码来比较2个图像文件,但即使在下载了所需的dependecies / jar文件后,CompareCmd类也未被识别并出现编译错误。

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
        }
    }

错误:         无法解析类CompareCmd      @第150行,第20栏。                CompareCmd compare = new CompareCmd()                           ^

有人能告诉我这个类是否仍然存在于最新版本的im4Java中?或者我错过了什么。

提前致谢。

0 个答案:

没有答案
相关问题