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
reactjs
ftp
cxf
mysqli
formatting
grpc
microcontroller
window.open
ibm
highmaps
data-modeling
sdk
qt4
obd-ii
wkhtmltopdf
facebook-sharer
osclass
guidewire
minimum
appsettings
web-worker
cucumberjs
android-actionbar
android-wifi
connectiq
windowserror
pydub
setup-project
kundera
federated
boost-log
qt-designer
unity3d-5
flex3
border-layout
maven-2
multi-user
rythm
nscollectionview
aspose.pdf
redbean
compiler-warnings
peerjs
ocamlbuild
mef
standard-error
ear
visio-2010
programming-pearls
business-catalyst
nsalert
trusted-computing
lightspeed
scanf
ldd
boost-range
disconnect
konakart
deck.js
recurring
php-java-bridge
calc
google-finance-api
app-data
javapackager
gitk
edgar
textblob
copy-on-write
skview
beagleboard
sony-xperia
method-overloading
frisby.js
os.walk
conditional-comments
register-allocation
zoneminder
cocos2d-x-2.x
im4java
atg-dynamo
webshim
image-preloader
html5-filesystem
lastinsertid
nsnumber
azure-scheduler
http-compression
exi
algol
cryptarithmetic-puzzle
gssapi
report-viewer2010
states
datejs
utm
gmagick
moss2007-security
s60
datarelation
chromebug
numerical-computing
uccapi
coderush-xpress
user-preferences
hotfix

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