Using very long commandlines with IM

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
bablokb
Posts: 29
Joined: 2005-06-11T06:21:59-07:00

Using very long commandlines with IM

Post by bablokb »

Hi,

is there a mechanism to call convert with a very long commandline? Something like

Code: Select all

convert @args.txt
and args.txt contains the commandline-arguments?

Bernhard
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Using very long commandlines with IM

Post by magick »

The ImageMagick command line does not directly support an indirect command line reference but some options do and you can wildcard the image filenames. For example,
  • convert '*.jpg' -draw @args.txt image.gif
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Using very long commandlines with IM

Post by fmw42 »

I think you should be able to put all your command line arguments in a file and write a script that would read the file and put all the text into a string variable and then have the IM command reference the string variable,

convert $commandlineargs

or

convert infile $comandlineparameters outfile
bablokb
Posts: 29
Joined: 2005-06-11T06:21:59-07:00

Re: Using very long commandlines with IM

Post by bablokb »

The script does not help, since the bash resolves the variable-reference and you are still left with a commandline which could be just too long. In fact, my very long commandline is generated that way.

Is is possible that a future version of IM could support reading the commandline from a file? In fact, IM is more like a programming-language, so why shouldn't it read it's program from a file?

Bernhard
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Re: Using very long commandlines with IM

Post by rmagick »

Note that ImageMagick can be called from a number of scripting languages right now: Perl, PHP, Ruby, etc. As you rightly point out, very long ImageMagick commands lines are very nearly as complicated as a program anyway. Instead of struggling with command shells, why not make the jump to a full-fledged programming language?
bablokb
Posts: 29
Joined: 2005-06-11T06:21:59-07:00

Re: Using very long commandlines with IM

Post by bablokb »

I have an image-processing system with 6700+ lines of bash-code. So the jump to a full-fledged programming language is not that easy. Anyhow, the current versions of bash _is_ a full-fledged programming language (well, almost).

There are certainly more important topics for IM to work on, but maybe you can put the issue on the long-run wish-list.

Thanks, Bernhard
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Using very long commandlines with IM

Post by magick »

We have this issue on our long term to-do list. It is not a high priority but it most likely will be implemented within the next few months.
Post Reply