4

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

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

The problem is that Info() don“t recognize the image. An exception is called:

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 put the complete route but it not works. Then I tried to do it with the comand and the operation, and don't 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");

The error is:

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)
imulsion
  • 8,820
  • 20
  • 54
  • 84
Helia
  • 67
  • 12

1 Answers1

0

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