It is probably failing as you have another layer of quoting involvedcssEXp wrote:as i said before the following doesn't work,
Code: Select all
exec("convert $image null: \( \"$watermark\" -coalease -channel A -evaluate multiply .5 \) -gravity SouthEast -layers composite -layers Optimize $image");
due to the PHP wrapper around the shell command.
You not only need to change " to \"
but you need to double any existing '\' in the command so that \( will need to become \\( so that the shell sees the backslash!
Alternatively use single quotes '(' around the parenthesis for either a direct shell command, OR as in your case a PHP quoted command. The single quotes do not require any extra backslash escaping.
The -draw command has a option called fill-opacity but I do not know if this effects a draw image. Seehow do i set opacity for the one with -draw, consider the following
http://imagemagick.org/Usage/draw/#mvg_settings
If that does not work however. your only solution is to pre-process the static image, as -draw will only read images from a 'image read source'.
For example using a pipeline...
Code: Select all
convert "$watermark" -channel A -evaluate .3 +channel miff:- |\
convert $image -coalesce -gravity north-west \
-draw 'image over 0,0 0,0 "-" $image
Alternatively you can do it in one command using the Image Processing Register "mpr:" See
http://imagemagick.org/Usage/files/#mpr
Code: Select all
convert "$watermark" -channel A -evaluate .3 +channel \
-write mpr:wmark +delete \
$image -coalesce -gravity north-west \
-draw 'image over 0,0 0,0 "mpr:wmark" $image
http://imagemagick.org/Usage/anim_mods/#compose_draw
NOTE: All the examples in IM examples are generated almost daily, using the code that is actually shown on the page itself (it is extracted from the web page and executed!) using images provided or generated by previous examples. The results you see in IM examples, IS the result you should get, IF your IM is up-to-date.