Hi,
I currently create a batch file (.bat) that executes over 400 commands, ie magick is executed over 400 times.
Is it possible, and if so how, can I build a file that contains the commands and then have magick (in one execution) run the 400 commands.
This would be for performance reasons. I have "MAGICK_THREAD_LIMIT=1" set to stop multiple threads from running, there are dependencies in the commands.
Many thanks for your consideration any help will be greatly appreciated.
jb2233
Run imagemagick commands from a file in windows
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Run imagemagick commands from a file in windows
Yes, multiple invocations of magick can be combined into a single call to magick, which will take less time. In addition, if any invocations write results to disk that are only for reading by other invocations, these can be stored in memory within the single invocation, which reduces disk IO.
How? Just create one long magick command eg in a shell script, or put it in an IM script file that is called with "-script".
A couple of points:
1. A magick command has an implied "-write" before the final filename. As this will no longer be the final filename, you must make this explicit.
2. After each "-write filename", empty the image list, eg with "-delete 0--1".
3. If individual invocations change settings (eg "-compose CopyOpacity") but other invocations assume default values, you must explicitly set the values back to default (eg "-compose Over"). Sadly, there is no operation that changes all settings to defaults.
4. When combining multiple invocations into one, you should test that the outputs from the new code matches the output from the old code.
How? Just create one long magick command eg in a shell script, or put it in an IM script file that is called with "-script".
A couple of points:
1. A magick command has an implied "-write" before the final filename. As this will no longer be the final filename, you must make this explicit.
2. After each "-write filename", empty the image list, eg with "-delete 0--1".
3. If individual invocations change settings (eg "-compose CopyOpacity") but other invocations assume default values, you must explicitly set the values back to default (eg "-compose Over"). Sadly, there is no operation that changes all settings to defaults.
4. When combining multiple invocations into one, you should test that the outputs from the new code matches the output from the old code.
snibgo's IM pages: im.snibgo.com
Re: Run imagemagick commands from a file in windows
Many thanks for the quick response, I will try this out