conjure and multiple directories, or alternative

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
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

conjure and multiple directories, or alternative

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: conjure and multiple directories, or alternative

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: conjure and multiple directories, or alternative

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: conjure and multiple directories, or alternative

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: conjure and multiple directories, or alternative

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: conjure and multiple directories, or alternative

Post 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.
snibgo's IM pages: im.snibgo.com
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: conjure and multiple directories, or alternative

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: conjure and multiple directories, or alternative

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: conjure and multiple directories, or alternative

Post 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!
Post Reply