magick command gives unable to open image error

2.3k views Asked by At

I am trying to run below command from my command prompt and it gives me following error:

magick billadd1.jpg -type TrueColorAlpha billadd2.jpg -type TrueColorAlpha \( -clone 0,1 -compose difference -composite -morphology dilate disk:10 \) \( -clone 0 -fill yellow -colorize 100 -channel a -evaluate set 50% +channel \) \( -clone 0,3,2 -compose over -composite +write 1.jpg \) \( -clone 1,3,2 -compose over -composite +write 2.jpg \) null:

magick: unable to open image '\(': No such file or directory @ error/blob.c/OpenBlob/3537.

magick: no decode delegate for this image format `' @ error/constitute.c/ReadImage/562.

Also, how to run this command from java using im4java?

Note i am using imagemagick veriosn7

1

There are 1 answers

0
Mark Setchell On

The Windows syntax is different from Unix/Linux syntax. Your command is currently in Unix/Linux syntax:

magick billadd1.jpg -type TrueColorAlpha billadd2.jpg -type TrueColorAlpha          \
    \( -clone 0,1 -compose difference -composite -morphology dilate disk:10 \)      \
    \( -clone 0 -fill yellow -colorize 100 -channel a -evaluate set 50% +channel \) \
    \( -clone 0,3,2 -compose over -composite +write 1.jpg \)                        \
    \( -clone 1,3,2 -compose over -composite +write 2.jpg \) null:

Which, when converted to Windows, probably becomes:

magick billadd1.jpg -type TrueColorAlpha billadd2.jpg -type TrueColorAlpha ^
   ( -clone 0,1 -compose difference -composite -morphology dilate disk:10 ) ^
   ( -clone 0 -fill yellow -colorize 100 -channel a -evaluate set 50%% +channel  ) ^
   ( -clone 0,3,2 -compose over -composite +write 1.jpg ) ^
   ( -clone 1,3,2 -compose over -composite +write 2.jpg ) null:

So, the rules are something like this to go from Linux to Windows:

  • remove backslashes before parentheses
  • change backslash line-continuation character to caret (^)
  • double up any percent signs
  • change any single quotes to double-quotes

There are some more detailed notes here.