Page 1 of 1

conjure and multiple directories, or alternative

Posted: 2013-02-07T08:35:04-07:00
by holden
Is it possible in a conjured .msl file to read/write multiple directories? Basically I need to know if I can add more to this: <write filename="xyz.jpg" />

or, can IM read from a text file containing multiple different commands on multiple images using the regular command line syntax?

Basically the usage is processing orders from a web interface- the user would specify things like borders, cropping, etc, code would translate this to IM friendly commands, IM would reference the user's upload folder, crunch out the images, and save the modified images into a different folder. Thanks.

Re: conjure and multiple directories, or alternative

Posted: 2013-02-07T13:12:18-07:00
by snibgo
I know nothing about msl.

When I'm doing very complex processing, such as video editing with frame grading, zoom, pan, fades, cross-fades, captions, transitions, layering, special effects and so on, my software writes script files, then executes them. This creates a small overhead in running "convert" for every frame, but this typically needs only about 1% more time, and brings great benefits for debugging and maintenance.

Re: conjure and multiple directories, or alternative

Posted: 2013-02-07T19:36:08-07:00
by anthony
MSL was an idea that never really jelled in my thinking.

Using convert instead on the other had expanded enormously from the point IMv6 started to present day, and has basically usurped the role the MSL was meant to provide (multiple image processing steps in one command).

IMv7 "magick" is designed to take this to the next level with applications able to 'script' or 'pipe' options (image processing operations) into the command, rather than having to generate huge long command lines. You can even generate the options on the fly (though examples of doing this are yet to be developed), depending on previous outcomes, using a technique known as co-processing (essentially a daemon background "magick" command.

The latest update allowing the storing images in a separate "distribute-cache" via a port expands this idea into a 'image holding process' without needing to use "co-processing". I haven't really tested it out myself but it looks promising.

Re: conjure and multiple directories, or alternative

Posted: 2013-02-08T09:17:48-07:00
by holden
my software writes script files, then executes them.
snibgo, are you on Windows? If so how do you make a script exectute in the command line automatically?
IMv7 "magick" is designed to take this to the next level with applications able to 'script' or 'pipe' options (image processing operations) into the command
This is interesting, are there any docs or information available yet? Also, is there an approximate ETA for v7?

Thanks for the responses

Re: conjure and multiple directories, or alternative

Posted: 2013-02-08T09:26:53-07:00
by magick
IMv7 is scheduled for Beta release 20131015 and an official release 20140701. These dates are not firm and may slip. In the mean-time, IMv7 alpha is available for testing, we include a Windows binary distribution @ http://www.imagemagick.org/download/alpha.

Re: conjure and multiple directories, or alternative

Posted: 2013-02-08T09:57:15-07:00
by snibgo
holden wrote:snibgo, are you on Windows? If so how do you make a script exectute in the command line automatically?
Mostly Windows, yes. I'm not sure what you mean; CPP code writes script files, then executes them with spawn() or system() calls.

I suppose it would be possible to have a daemon that watched out for new script files appearing, and execute them.

Re: conjure and multiple directories, or alternative

Posted: 2013-02-08T13:16:01-07:00
by holden
Thanks for the help- what appears to be a good method is to save orders as a .bat file so that we can use the standard IM syntax :D

Re: conjure and multiple directories, or alternative

Posted: 2013-02-10T16:49:29-07:00
by anthony
Documentation of Magick Scripting, is in "Development and Bugs" section of IM Example.
http://www.imagemagick.org/Usage/bugs/

The batch handling is complete. Including DOS! Though I am not a DOS programmer.
http://www.imagemagick.org/Usage/bugs/I ... ipting.txt


Note: A mixed image/command pipeline handling has not been worked out. That is piping commands and some images (streaming formats), in the same pipeline, has not been resolved.

Hmmmm... seems that document was not updated with the DOS script handling! (up dating)

Here is an extract form the source comments (file "MagickWand/script-token.c") for that aspect.

Code: Select all

DOS script launcher...

Similarly any '@' at the start of the line (outside of quotes) will also be
treated as comment. This allow you to create a DOS script launcher, to
allow a ".bat" DOS scripts to run as "magick" scripts instead.

  @echo This line is DOS executed but ignored by Magick
  @magick -script %~dpnx0 %*
  @echo This line is processed after the Magick script is finished
  @GOTO :EOF
  #
  # The rest of the file is magick script
  -read label:"This is a Magick Script!"
  -write show: -exit

But this can also be used as a shell script launcher as well!
Though is more restrictive and less free-form than using ':'.

    #!/bin/sh
    @() { exec magick -script "$@"; }
    @ "$0" "$@"; exit
    #
    # The rest of the file is magick script
    -read label:"This is a Magick Script!"
    -write show: -exit

Or even like this...

    #!/bin/sh
    @() { }
    @; exec magick -script "$0" "$@"; exit
    #
    # The rest of the file is magick script
    -read label:"This is a Magick Script!"
    -write show: -exit
Basically I tried to make the script handling as versatile as possible

Re: conjure and multiple directories, or alternative

Posted: 2013-02-11T10:00:55-07:00
by holden
Anthony thanks for the links and coding efforts, I will keep an eye on this most definitely. Is this something in the current release? It seems like the project is updated quite frequently.

*edit- sorry, missed the v7 tag in the link!