Im4java see photo

I tried to read the image in Java with the im4java library:

File file = new File("img\\test.jpg"); Info imageInfo = new Info(file.getPath(),true); 

The problem is that Info () does not recognize the image. An exception is thrown:

 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) 

In the route, I tried to complete the full route, but it does not work. Then I tried to do this with the command and operation and did not work:

  // 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"); 

Error:

 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) 
+4
source share
1 answer

You can set the search path to install ImageMagick and try: ProcessStarter.setGlobalSearchPath ("$ PATH: <>");

0
source

Source: https://habr.com/ru/post/1486501/


All Articles