The problem is that '%' is often a special flag to options like -size that have a geomerty type argument.
One of the solutions we have thought about is that if the option argument is prefixed with a '=' then the whole argument that follows that inital '=' will be put though escape expandion.
However the problem is that the convert/mogrify command line API is very old with a lot of old handling from previous versions, such as IMv5 and legacy argument handling. For example it current processes the command line twice!!!!
What is really needed is for the command line API to be re-written in such as way as to allow...
- argument processing, purely in the IMv6 argument ordering
- the ability to read all arguments from a file (convert scripts!). This could allow you to call IM, such as from PHP, without needing to do so though a shell wrapper. That is
start IM as a piped open, and feed the commands to it.
- a proper separation of command line API from the IM core library
- a fully defined argument processing methology
- argument string from file ("@filename")
- insertion of numbers (with/without math processing) of values extracted from images already in memory
- a proper handling of global settings, verses image attribute settings. Say snapshot and restore global settings.
- Posible loop mechisims. Such as Loop over images, repeat X times, or look with some number, accessable as a percent escape.
- if-then-else constructs for command line/script handling.
This re-write may require some re-coding of mogrify which current does some very weird argument handling to seperate the list of images to process, from the operations and settings needed to process them. For example some settings need to be pre-set before reading the first image!
Actually is a "loop over image list" type construct is implemented, then it may be posible to make 'morgify' a special case of convert, just as 'montage' is a special convert with post processing of the final image list in memory.
This new command line API could in fact be done as a separate command to convert, but will need someone to get the ball rolling and keep it moving. One previous attempt that failed (probably was done before IM was ready for it) was "conjure". the new version would have to be BOTH command line and script capable, and do what convert does to properly replace convert.
This may be a good topic for discussion on the devlopers forum!