Escaping ( in Mac not working

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mmackay
Posts: 4
Joined: 2017-09-11T15:48:03-07:00
Authentication code: 1151

Escaping ( in Mac not working

Post by mmackay »

Trying a very simple command from the doc's and failing with what I am suspecting is a /( issue.

convert -size 1439x600 gradient:rgba\( 70, 131, 177, 0.85\) -rgba\( 70, 131, 177, 0.3\) ./greenbar.gif

I get:

Code: Select all

convert: unrecognized color `(' @ warning/color.c/QueryColorCompliance/2395.
convert: unable to open image '70,': No such file or directory @ error/blob.c/OpenBlob/3146.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/509.
convert: unable to open image '131,': No such file or directory @ error/blob.c/OpenBlob/3146.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/509.
convert: unable to open image '177,': No such file or directory @ error/blob.c/OpenBlob/3146.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/509.
convert: unable to open image '0.85)': No such file or directory @ error/blob.c/OpenBlob/3146.
convert: no decode delegate for this image format `85)' @ error/constitute.c/ReadImage/509.
convert: unrecognized option `-rgba(' @ error/convert.c/ConvertImageCommand/2639.
If I quote it:

Code: Select all

convert -size 1439x600 gradient:rgba'(70, 131, 177, 0.85)'-rgba'(70, 131, 177, 0.3)' ./greenbar.gif
I get no errors but also no gradient.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Escaping ( in Mac not working

Post by fmw42 »

try

Code: Select all

convert -size 1439x600 gradient:"rgba(70, 131, 177, 0.85)-rgba(70, 131, 177, 0.3)" ./greenbar.gif
or

Code: Select all

convert -size 1439x600 gradient:"rgba(70,131,177,0.85)-rgba(70,131,177,0.3)" ./greenbar.gif

"White space characters are allowed around the numerical values, at least if the entire color argument is enclosed in quotes ('single quotes' for Unix-like systems, "double quotes" for Windows)." See http://www.imagemagick.org/script/color.php

Double quotes are fine for Unix-like systems also and needed if the color is put in a variable.
mmackay
Posts: 4
Joined: 2017-09-11T15:48:03-07:00
Authentication code: 1151

Re: Escaping ( in Mac not working

Post by mmackay »

Cool that worked - thanks for the quick response.

Mike
mmackay
Posts: 4
Joined: 2017-09-11T15:48:03-07:00
Authentication code: 1151

Re: Escaping ( in Mac not working

Post by mmackay »

Actually.. :)

I should caveat that I am not an expert in image manipulation....

The command runs but I am not seeing any gradient, almost as if the alpha is being ignored?

Basically my goal is to take a background image and insert a single colored overlay from top to bottom, starting with a .85 alpha at the top and .3 at the bottom.

Was thinking I could build a background and then overly that on top of the image, but does not seem to work.

Mike
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Escaping ( in Mac not working

Post by fmw42 »

Your problem is that gif only supports binary transparency (full on or full off). Change your output to png and it should look fine.
mmackay
Posts: 4
Joined: 2017-09-11T15:48:03-07:00
Authentication code: 1151

Re: Escaping ( in Mac not working

Post by mmackay »

Worked great thanks - I did say I was a beginner in this area.

BTW - love these forums, they are very responsive.

Thank you for your help
Post Reply