Trying to use shell command in ubuntu for image magick

hi I am using the shell() command in swi-prolog in ubuntu linux to send commands to the commandline to let Image magick convert images.

now i have this commandline below with in itself does work, it does what it has to do.( In linux back slash is treated as line continuation. )

when i construct the exact same String in swi-prolog en give this string to the Shell -predicate it doesnt work.

( i hope the forum displays the slashes of my command below )

What can i do to solve, ive tried a lot of things but doesnt work

convert /home/drspro/HSW_PICS_DA/set_pics_mach/tjscb.jpg \( -clone 0 -blur 0x1 \) \( -clone 0 -fill black -colorize 10 \) \( -clone 0 -define convolve:scale='!' -define morphology:compose=Lighten -morphology Convolve 'Sobel:>' -negate -evaluate pow 5 -negate -level 20x80% \) -delete 0 -compose over -composite /home/drspro/HSW_PICS_DA/cartoon_mach/result.jpg

This is not an answer but more info for others reading your question.

While I have used ImageMagick and IIRC used it from SWI-Prolog via command line I don’t ever recall seeing ( ) being used on the command line. So for others here is what I found

Eric thankyou for your information,

it seems i have it working now, i accidentally added a space between - and clone in my prolog code, and with that it was standing still without error messages. but now it seems to work

Mostly should work fine. Note however that Prolog quoted atoms/strings require a \ to be escaped as \\. Prolog gives the resulting command to the shell.

Typically it is easier to use process_create/3 as you simply give a Prolog list of process arguments that the library makes sure the process is called the right way. So you get something like

                   [ file('/home/drspro/HSW_PICS_DA/set_pics_mach/tjscb.jpg'), 
                     '(', '-clone', '0', '-blur', '0x1', ')',

Using the proper annotations, process_create/3 makes sure the same also runs on Windows.

i was aware of this and i used dubbel back slash inside the string in the swi prolog code, then when you use the same string in the shell command , it should output 1 backward slash i think, though when you use : term_string( Thestring , Output ), and you use write( Output ) you will get 2 back slashes