我尝试用im4java库读取Java中的一个图像:
File file = new File("img\\test.jpg");
Info imageInfo = new Info(file.getPath(),true);问题是Info()不能识别图像。一个异常被称为:
Exception in thread "main" org.im4java.core.InfoException: org.im4java.core.CommandException: java.io.IOException: Cannot run program "identify": CreateProcess error=2, The sistem can not find the specific file.
at org.im4java.core.Info.getBaseInfo(Info.java:360)
at org.im4java.core.Info.<init>(Info.java:151)
at FeatureExtractor.main(FeatureExtractor.java:51)在路线中,我试着把完整的路线放进去,但它不起作用。然后我试着用命令和操作来做这件事,但是没有起作用:
// create command
ConvertCmd cmd = new ConvertCmd();
//cmd.setSearchPath("img");
// create the operation, add images and operators/options
IMOperation op = new IMOperation();
op.addImage("img\\test.jpg");错误是:
org.im4java.core.CommandException: org.im4java.core.CommandException: Specification not valid.
at org.im4java.core.ImageCommand.run(ImageCommand.java:219)
at FeatureExtractor.main(FeatureExtractor.java:28)发布于 2016-06-20 19:02:49
您可以设置ImageMagick安装的搜索路径,然后尝试: ProcessStarter.setGlobalSearchPath("$PATH:<>");
https://stackoverflow.com/questions/17136771
复制相似问题