im4java


im4java compare command giving Command exception


Following code gives org.im4java.core.CommandException: org.im4java.core.CommandException: return code: 1 I am trying to compare two colors. what is wrong in my code or what is the correct solution to compare colors.
ImageCommand compare=new ImageCommand();
compare.setCommand("compare");
IMOperation op = new IMOperation();
op.fuzz(30.0);
op.metric("AE");
op.addImage();
op.addImage();
op.addImage();
compare.run(op,"xc:green","xc:brown","null:");
It's because ImageMagick's compare will return a non-zero exit code if the images are dissimilar. But the comparison should be working, the resulting difference image (3rd argument) is correctly generated.
It's however a problem for im4java because that's considered an error exit code, and there's no way as far as I know to tell im4java that it's not. See this discussion for more details.
You can work around it by catching the exception and ignoring it if the return code was 1 (compare should return 2 in case of error).

Related Links

Im4Java - How to make transparent PNG based watermark in corner sized proportionally
im4java compare command giving Command exception

Categories

HOME
drupal
max
logging
oop
grizzly
stata
macros
ide
domain-driven-design
ssh
qemu
openacc
casting
abc
microcontroller
dronekit
bigtable
glsl
django-middleware
data-modeling
assign
hiveql
datetimepicker
mailchimp
swap
autocad
servicenow
jquery-select2
restheart
mongoimport
mamp
aspectj
yui
lambda-calculus
exchange-transport-agents
openstack-horizon
web-worker
loss
hapijs
civicrm
scotty
udeploy
ampscript
ejb-3.1
smali
wai-aria
advertising
chartist.js
ckeditor4.x
symlink
orgchart
tftp
mex
angular-schema-form
dynamics-ax-2012-r3
ipython-parallel
2checkout
folder
textview
ibm-bpm
loopback
slim-lang
gitosis
odp.net
headphones
cache-control
flex3
border-layout
motherboard
anypoint-studio
libconfig
ngrok
icu
rbac
togglebutton
runner
remap
confluent
evaluation
cloudconvert
overhead
zedgraph
suitesparse
spring-social-twitter
dimensionality-reduction
boost-range
jira-agile
instaparse
syslog4j
database-administration
window.location
jmh
treelist
clique
containstable
google-finance-api
gtkwave
magnet-uri
autoscaling
vectordrawable
teamwork
numerical-recipes
static-files
random-access
ios-enterprise
oxygenxml
parallel-port
windows-phone-store
boofcv
azure-scheduler
idoc
tasklist
report-viewer2010
custom-cursor
blackberry-eclipse-plugin
nsscrollview
mvcmailer
yii-cactiverecord
jquery-click-event
service-layer
method-call
nbehave
http-response-codes
database-agnostic
browser-state
ironpython-studio
tracd

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App