Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

The program should run in batch mode to resize all files in a folder and then save new files to different folder. An option for setting jpg quality would be great, too.

share|improve this question
2  
A combination of find and ImageMagic. –  mspasov Feb 24 '12 at 12:05

11 Answers 11

up vote 30 down vote accepted

I'm a little surprised that no one has mentioned the easiest, cheapest, and least technical option:

Automator

First, open Automator, which is in your Applications folder.

Next, choose to create a new workflow:

Create an automator workflow

Next, add the following steps to the workflow by dragging and dropping:

workflow steps

When you run this, Automator is going to:

  1. pop up a window asking you to pick some files (as many as you want)
  2. pop up another window asking where you want to save the resized copies
  3. ask you how big you want the resized copies to be. You'll be able to choose either a fixed size or a percentage. All the images will be resized to either that size or by that percentage.

(The "show this action when the workflow runs" checkbox means that the workflow is going to pause, display the option, and allow you to change it then)

Once you do that, Automator is going to churn and burn, and when it's done it'll beep at you.

Unfortunately, it doesn't seem to have an option to choose JPEG quality. However, for the price (free), it's pretty dang convenient.

share|improve this answer
    
It maybe the least technical for someone who does not use Terminal. And possibly the easiest, But its not the cheapest out of the answers here. Sips is included in the Unix build of the Mac. And ImageMagick is also free. –  markhunte Feb 24 '12 at 7:18
3  
It's safe to assume that Automator is, for the purposes of this discussion free because it is reasonable to assume that @mototribe is running OS X. My one concern would be how well Automator would handle 100,000 images but, assuming they're not all in a single folder, I'd just keep feeding it one folder at a time until it was done. I've run this very workflow against hundreds of images without difficulty. I see no reason why it wouldn't work against many thousands, as each image is pushed through one-at-a-time, but I'd be in trust but verify mode. –  jaberg Mar 1 '12 at 18:51
    
Yep Automator did the job perfectly. I came here thinking "I have find a command line utility that would batch-resize images"... Sometimes the easiest solution is also the best. Cheers. –  Silouane Gerin Jun 28 '13 at 19:34

Graphic Converter

The best for this..

share|improve this answer
7  
Can you explain why GC is the best option? –  Nathan Greenstein Feb 24 '12 at 1:04
    
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  daviesgeek Feb 24 '12 at 18:10

I use wine (and XQuartz) and IrfanView. Of course you could also use imagemagick from the command-line. For wine and imagemagick I would recommend Homebrew.

irfanview in wine on OS X

share|improve this answer
    
I've used Irfanview for over 10 years on the PC and love it. But they don't have a Mac version? –  MotoTribe Feb 24 '12 at 1:43
1  
I Suspect they mean they run IrFranView under wine. Wine lets you run Windows software on other operating systems. With Wine, you can install and run these applications just like you would in Windows. The screenshot clearly shows Mac type windows (buttons at top) with PC Window GUI –  markhunte Feb 24 '12 at 7:21
5  
Using Wine with a Windows application is really an overkill for something that you can do natively. –  Matteo Feb 24 '12 at 11:20

ImageMagick is a command line interface program and made for this purpose. The use and installation of ImageMagick can intimidating, but this image manipulation package is the most powerfull I have encountered so far. As the installation from source can be a hassle for native OS X users I advise you to use Homebrew.

To install ImageMagick using Homebrew run this oneliner in your terminal:

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Homebrew is now installed, it is wise to follow the installer's suggestions after installation. Now we install ImageMagick using brew.

brew install imagemagick

ImageMagick is now installed and it's convert program can be used for your purpose. To convert a big jpg image to a smaller png image your can run

convert input.jpg -geometry 800x600 output.png

To answer your question "How to resize all files in a folder and save them in a different folder" you can run the following script.

# create output dir
mkdir -p "../resized"

# Convert all .jpg files in the current folder
for image in *.jpg; do
    convert $x -geometry 800x600 resized/$x
done

ImageMagick can convert over 100 different image formats, and almost all tricks you can do with Photoshop you can do with ImageMagick.

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

    
thanks, that's what I ended up using - however I installed it on Drupal since I'm importing the images into Drupal. –  MotoTribe Feb 25 '12 at 3:24
    
@the_karel, I just enhanced your previous post. I hope you do not mind. –  CousinCocaine Sep 18 '13 at 6:50
    
@grgarside, thanks for the corrections. –  CousinCocaine Sep 18 '13 at 9:33

I like to use ImageMagick. sips and Automator (which use an identical resizing method) make images look too blurry without additional sharpening in my opinion.

You can install ImageMagick with brew install imagemagick after installing Homebrew or with sudo port install imagemagick after installing MacPorts. Then run a command like this:

mogrify -filter lanczos2 -resize '500x500>' -format jpg -quality 90 -path /tmp/ *.jpg

500x500> makes images wider or taller than 500px fit to 500x500px. 500x would always change the width to 500 px and 500x500^ would make all images at least 500x500px. -path /tmp/ saves the output files to /tmp/ instead of modifying files in place.

Lanczos2 or the 2-lobe Lanczos is very similar to Catrom. Compared to Lanczos (Lanczos3), they are slightly less sharp, produce less ringing artifacts, and produce more Moiré patterns. The default filter for making images smaller is Triangle, which often makes images too blurry in my opinion.

-quality 100 creates files about twice as big -quality 95, which creates files about twice as big as -quality 88.

More information:

http://www.imagemagick.org/Usage/resize/
http://www.imagemagick.org/Usage/filter/
http://lri.me/shell1.txt

Here's a similar command that uses sips:

for f in *.jpg; do sips -Z 500 -s format jpeg -s formatOptions 80 "$f" /tmp/; done

-Z 500 is like 500x500> in ImageMagick.

If others have less than 100,000 images, you might also use Preview:

Preview used to use the same resizing method as sips and Automator, but it has used a different one since 10.7. I prefer ImageMagick's Lanczos2 though.

I uploaded a comparison of the different options to http://19a5b0.s3-website-us-west-2.amazonaws.com/imagemagick-osx-resizing/index.html.

share|improve this answer
1  
I'd like to warn you to use mogrify: this converts the files in-place, overwriting the original ones! If anything goes wrong, you have lost your files! Better use convert (also from ImageMagick). –  Kurt Pfeifle Jul 6 '12 at 19:14
1  
@KurtPfeifle It doesn't if you specify the -path option (which convert doesn't currently have). –  ؘؘؘ Jul 17 '12 at 15:39
    
If you are going for speed then sips is maybe the better choice. On a quick test with 1,000 JPGs á ~5 MB resizing to 800px width took ~1 min. with sips and ~8 min. with mogrify (with disk buffers purged, using GNU Parallel on a quadcore). –  Stefan Schmidt Jan 25 at 18:59

Several people have mentioned ImageMagick. Here is a recipe: For simplicity, assume all the files are in one folder (and the folder contains nothing else). Open a terminal window, cd into this folder, then run

mkdir ../resized
for x in *.jpg; do convert -geometry 800x600 $x ../resized/$x

where you replace the 800x600 by whatever size you want.

Advantages include a great amount of flexibility in ImageMagick's convert, such as the ability to select different quality settings for the target image, or setting the resize option by percentages. Or you can use -geometry 800x800, in which case the aspect ratio will be preserved, but the maximum of the width and height will be 800 pixels.

Disadvantages are the obvious ones: It requires a certain familiarity with the command line, plus a willingness to plough through the command line options of convert for the settings you want. This is not a task for the faint of heart.

share|improve this answer

I usually import all of the pictures into iPhoto and then export them to the different sizes. I have done it on batches of 300 or so images, but never on the scale you are wanting. Still, it may be an option.

share|improve this answer

I second GraphicConverter. I've been a registered user for 16 years. Its main purpose is batch-processing image editing, and it has a good user interface for designing custom workflows and saving them.

You can also use it in conjunction with Automator, but you probably won't need to.

Here is some information from GraphicConverter's page explaining their batch processing image editing functions.

Batch conversion with additional functions

GraphicConverter offers you sophisticated batch processing which fully automates repetitive tasks applied to a selection of pictures:

  • Convert all the selected source pictures easily and quickly into a new format - regardless of whether there are 5 or 5,000 picture files; you just define the type of conversion and set the details
  • During the conversion process you can apply up to 60 additional batch functions such as rotation, resize, change the resolution, etc.
  • Automate the removal of the Mac OS Ressourcefork before documents are uploaded if there are compatibility problems when the picture files are placed in the internet
  • Create catalogs in HTML format for publication in the internet and adjust the colors, sizes, etc. to your individual requirements (see examples)
  • Rename a selection of documents according to special criteria quickly and easily
  • Join pictures together (e.g. for QuickTime VR)
  • Insert or extract IPTC information into or out of a variety of document formats
  • and much more ...

enter image description here

share|improve this answer

This is yet another simple, clean and effective batch image resize script. If you are dealing with graphics and different resolutions a lot, you can use this script and save it with different values for occasional uses.

Do so, by changing this target_width 120 value to your needs and save the script. Now drag your image(s) onto the saved script-file to start resizing your image(s).


Open Script Editor, and create the following new script:

-- save in Script Editor as Application
-- drag files to its icon in Finder

on open some_items
  repeat with this_item in some_items
    try
      rescale_and_save(this_item)
    end try
  end repeat
end open


to rescale_and_save(this_item)
  tell application "Image Events"
    launch
    set the target_width to 120
    -- open the image file
    set this_image to open this_item

    set typ to this_image's file type

    copy dimensions of this_image to {current_width, current_height}
    if current_width is greater than current_height then
      scale this_image to size target_width
    else
      -- figure out new height
      -- y2 = (y1 * x2) / x1
      set the new_height to (current_height * target_width) / current_width
      scale this_image to size new_height
    end if

    tell application "Finder" to set new_item to ¬
    (container of this_item as string) & "scaled." & (name of this_item)
    save this_image in new_item as typ

  end tell
end rescale_and_save

original source

share|improve this answer

No one has mentioned Apple Aperture.

While by no means the cheapest, it comes with a lot of other things that you may find useful. It basically replaces iPhoto and then some. It does 95% of what photographers commonly use Photoshop for. (It won't do flaming text. :-)

But unless you need the other things Aperture gives you, I second both the ImageMagick approach -- if you're not intimidated by downloading, installing, and running command-line programs, and the Automator approach, which despite @markhunte's claim, is free.

share|improve this answer

Preview is certainly a good solution for some occasional resizing. There are also other nice free options, such as ImageMagic (command-line utility), Preview or something else plus Automator, etc.

However, if this is a part of your job and you need a true flexibility, a special-purpose application will save you a lot of time, and offer much more opportunities. Many users chose our batch image resizer Resize Sense (http://veprit.com/resizesense) for its outstanding flexibility and convenience.

Disclaimer: I am the developer. You better judge Resize Sense yourself. The introductory video on the product website will tell you exactly what is so special in Resize Sense. There is a free demo version.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.