strantheman wrote:Hey bud, nope unfortunately that did not work for me either. When I tried different quotes I got the same error but with a period instead of "image"
Code: Select all
mogrify: Non-conforming drawing primitive definition `.'.
I hope maybe the moderator Anthony will stumble over this post and give it a shot. If I can't find something this week I guess I'll just have to use PHP and loop over all of the files in the directory myself and perform the command on each file individually.
Well I eventually stumbled over it...
Non-conforming drawing primitive definition
That means the -draw did not see all the arguments and setting it needed for that drawing primative. In your case it was probably that you escaped your quotes, making the parts of the draw string individual options, and NOT as SINGLE STRING.
Draw only takes ONE STRING, for all the draw commands and arguments.
Remove those backslashes..
Mogrify can NOT use -composite as it only deals with one image at a time. The -draw in mogrify adds the needed extra image as an argument, outside the normal image processing sequence.
composite only wants two or three images only. anything else is ignored. With three images the thrid would have been a mask any you would have gotten unexpected results being saved in the LAST image filename you gave, overwriting that image.
As for GLOB... That is the Command line shell method for handling and expanding the special 'shell filename meta-characters, like *, ?, and {}. It lets you do the expansion into a list of files in PHP and then loop on them, rather than having either the shell, (or if you quoted the globbed filename) ImageMagick doing the filename expansion.
WARNING: As a security issue, you should watch out for filenames that contain 'glob' meta-characters too as both IM and Shells will try to re-expand them again.
The problem is a file called 'I *?@;${&) a lot.jpg' is a perfectly legal filename under UNIX, but a LOT of programs will have trouble handling it if those programs (like shell and IM) also do filename globbing.
As a security measure it is often a good idea to error and abort if a filename has some unknown or unusual characters in it (like white space or glob meta-chars). Before passing such problem files to a shell command, or IM.
I started a 'security section' to the IM Examples API info area, which will appear in a day to two.
http://www.imagemagick.org/Usage/api/#security
Bonzo, you especially better read and understand it, or copy and expand on it.