Want to loop this script for all files in a folder

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
joshuafinny
Posts: 16
Joined: 2016-01-11T05:12:11-07:00
Authentication code: 1151

Want to loop this script for all files in a folder

Post by joshuafinny »

Script: convert image.jpg -fuzz 5% -fill #f1f0ee -opaque white -resize 720x1125 -background #f1f0ee -gravity center -extent 720x1125 output.jpg
Platform: Windows
Imagemagick Version: 6.9.3

How do I loop this script to run on all images in a folder? I want the input and output images to be in separate folders.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Want to loop this script for all files in a folder

Post by snibgo »

See documentation for your script language. Hint: "help for".
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Want to loop this script for all files in a folder

Post by fmw42 »

see mogrify at http://www.imagemagick.org/Usage/basics/#mogrify

create a new directory (test2)
cd to your existing image directory (test1)

Code: Select all

mogrify -path path2/test2 -format jpg -fuzz 5% -fill "#f1f0ee" -opaque white -resize 720x1125 -background "#f1f0ee" -gravity center -extent 720x1125 *
On unix, quotes are required about hex colors.
Post Reply