using wildcards in command line

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
Arlene

using wildcards in command line

Post by Arlene »

I am trying to use the following command line:

convert -resample 300x300 -scale 250x -crop 250x350 *.* *.pdf

and the system doesn't seem to like the wildcard syntax ... any suggestions?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

What system. Unide UNIX the '*' are often expanded by the command line shell, under DOS the program itself has to to the expandsion. Both UNIX and Windows IM can do the expandsion, but may require quotes to prevent the command line shell expanding the wildcards.


Finally... READ in the images BEFORE you process them!!! Otherwise you may get unexpected ordering of operations.

Code: Select all

convert "*.*" -resample 300x300 -scale 250x -crop 250x350 +repage result.pdf
READ these IM example sections..
http://www.cit.gu.edu.au/~anthony/graph ... s/#postfix
http://www.cit.gu.edu.au/~anthony/graph ... rop_repage
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Arlene

wildcard usage

Post by Arlene »

thank you for the repage tip and I am using a Windows 2000 Advanced server and running these scripts basically thru a dos command line

so would like the code to run an entire directory of files and output the files to a different directory as pdfs, i.e.,

convert "*.*" -resample 300x300 -scale 250x -crop 250x350 +repage "c:\crop\out\*.pdf"

but unfortunately this does not produce any results ... any ideas?

Arlene
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

OH. you want seperate pdf's. Wrong command. You example looks like you wanted to combine ALL images into one pdf!
What you were after is "montage" with a -format option. Though that will generate pdf's in the same directory.

See Montage, in-place batch processing
http://www.cit.gu.edu.au/~anthony/graph ... s/#mogrify

At the end of that section is
Batch Processing - Without using "mogrify"
http://www.cit.gu.edu.au/~anthony/graph ... ogrify_not

This show other looping methods that can use convert and output to different directories, but these are more UNIX centric, However you could install centrix on windows and use its scripting power. Then again you could use some other programming scripting too, like visual basic, or PHP, or Perl too.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply