I'm getting an "org.im4java.core.CommandException: 16" error attempting run a compare command as a Java application. It works fine when I run from the command line and from the generated script produced by calling ImageCommand.createScript().
I'm running jdk1.7.0_67 on a MBPro OS X 10.9.5
I'm using this dependency:
<dependency>
<groupId>org.im4java</groupId>
<artifactId>im4java</artifactId>
<version>1.4.0</version>
</dependency>
I have no idea why I'm getting this exception. I do find it interesting that the value "16" reported in the exception is the exact number of different pixels between the test images.
Also, does anyone know if there is a source.jar?
Any help would be greatly appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-11-05
I think maybe I'm misunderstanding how compare.run() should behave. It seems like it will "always" throw an exception which is just the return status of the underlying command-line compare command? Is this true?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, you are right. If im4java detects output to stderr, it will automatically create a CommandException. The compare command writes the output of the -metric operator to stderr, so it will always throw an exception. Writing "normal" output to stderr is highly questionable, but this allows you to pipe the diff-image to stdout like you do in your code.
If you really want robust code with the compare command, you have to catch the exception and inspect the error text. If it is just a number, you are fine, if it is more than that there is probably a real problem.
BTW: full source code is available from this project site.
Bernhard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-11-06
Thank-you Bernhard!
Kendall
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm getting an "org.im4java.core.CommandException: 16" error attempting run a compare command as a Java application. It works fine when I run from the command line and from the generated script produced by calling ImageCommand.createScript().
I'm running jdk1.7.0_67 on a MBPro OS X 10.9.5
I'm using this dependency:
<dependency>
<groupId>org.im4java</groupId>
<artifactId>im4java</artifactId>
<version>1.4.0</version>
</dependency>
Here is my simple test Java app:
I have no idea why I'm getting this exception. I do find it interesting that the value "16" reported in the exception is the exact number of different pixels between the test images.
Also, does anyone know if there is a source.jar?
Any help would be greatly appreciated.
I think maybe I'm misunderstanding how compare.run() should behave. It seems like it will "always" throw an exception which is just the return status of the underlying command-line compare command? Is this true?
Yes, you are right. If im4java detects output to stderr, it will automatically create a CommandException. The compare command writes the output of the -metric operator to stderr, so it will always throw an exception. Writing "normal" output to stderr is highly questionable, but this allows you to pipe the diff-image to stdout like you do in your code.
If you really want robust code with the compare command, you have to catch the exception and inspect the error text. If it is just a number, you are fine, if it is more than that there is probably a real problem.
BTW: full source code is available from this project site.
Bernhard
Thank-you Bernhard!
Kendall