demosthenes.info

I’m Dudley Storey, the author of Pro CSS3 Animation. This is my blog, where I talk about web design and development with , and . To receive more information, including news, updates, and tips, you should follow me on Twitter or add me on Google+.

web developer guide

my books

Book cover of Pro CSS3 AnimationPro CSS3 Animation, Apress, 2013

my projects

CSSslidy: an auto-generated #RWD image slider. 1.5K of JS, no JQuery. Drop in images, add a line of CSS. Done.

tipster.ioAutomatically provides local tipping customs and percentages for services anywhere.

PhotoShop Batch Processing: Generating Image Thumbnails via Automated Crop & Resize

tools / photoshop

Estimated reading time: 6 minutes, 7 seconds

If you are executing the same simple sequence of operations in PhotoShop on two or three images, it’s usually fastest to do so manually. But the moment that you repeat the steps more than a few times, it is easiest to record the operation as an automated process.

500pxApplying an automated sequence of operations to a set of images is known as “batch processing”.  Batch processing is typically used to create a series of thumbnails for a gallery, or interchangeable banner images, or headshots for the profile page of a board of directors. In this tutorial we’re using the first example, but in all cases, the final images need to be the same size and aspect ratio. I’ll be using images from 500px.com, my newest favourite photography site: the photographs are by Mike Orbinski, Dale Martin, and Tom Lowe.

For a real-world example, you would want your source images to be as high a resolution as possible, and in a lossless format, in order to preserve the highest quality possible during our workflow.

In PhotoShop we wish to execute two steps:

  • Crop an image to the width and height that will be shared by all thumbnails.
  • Export the image in a web-ready format.

This sequence will then be “replayed” on all of our images to generate all the thumbnails we need.

For this example you can use any random assortment of images: the more images and the greater variation in height, width and format, the better. You’ll need at least three, placed in a folder named source. You’ll also want another folder location with a distinct name, such as destination.

The first step in batch processing is to record the sequence of actions that you wish to perform on every image. Think of this as a recorded rehearsal.

Before you begin, make sure you have PhotoShop set up correctly (here I’m using Adobe PhotoShop CS5). It is particularly important to ensure that you have set PhotoShop’s preferences to measure everything in pixels.

Step 1: Set up the crop tool and open your rehearsal image

PhotoShop Crop SettingsTo ensure that we always crop our images to the same aspect ratio and generate thumbnails that are the right size, choose the crop tool (C on your keyboard) and insert an appropriate width and height measurements for the final image in the Property bar. I’d suggest a square image, 150px × 150px. You may as well set the resolution to 72 pixels per inch at the same time.

In order to be prepared for the next step, open one of your images from the source folder: it doesn’t particularly matter which one.

Step 2: Start a new action.

(If you can’t see the Action window, choose Window / Actions from the PhotoShop menu bar, and click on the New Action button in the bottom right corner). Your action can be given any unique name, and be associated with any set or function key. The important thing to remember is that once you press Record every action you take will be recorded. You can edit the steps taken in the action afterwards, but it is best to have as “clean” a recording of your process as possible. Take your time in the next step.

Step 3: Crop your image

PhotoShop Image CropUse the crop tool to select a portion of your image; press Enter on your keyboard to execute the crop. Note that the crop marquee is restricted to a square, due to the dimensions we added in the property bar in the first step. When the crop is completed, whatever is inside the marquee area is resized to the dimensions we specified. That is, you can make the crop area as large or as small as you like, but the cropped result will always be exactly 150px × 150px in size.

Step 4: Stop recording your action.

A fairly common mistake is to continue working after this point, forgetting that the action is still recording. Stop the recording of the action by pressing the square Stop button to the left of the Record button at the bottom of the Actions window. Do not save the image; we won’t export images at this time.

Step 6: Batch process your folder of images

PhotoShop Batch DialogWith your action recorded, you can now replay this action on your folder of images. In the PhotoShop menu bar, go to File / Automate / Batch…

PhotoShop automatically assumes that we want to run the action we just recorded. Choose the source folder containing our original images as our source. Choose Folder as the Destination and locate the other folder you made.

As soon as you press OK, the batch process will run. PhotoShop will go through the images, execute the cropping process on each, and save the results in the same format (if JPEGs, you will be prompted for compression quality).

Step 7: Inspect your output images

You will find that the cropped-and-resized version of the image you rehearsed on is just right, but the other images may look “off”. That is because PhotoShop is assuming everything about the crop process, including the position of the top left corner and the size of the crop area, which was set up in the original action we recorded.  Let’s assume that we want control over the position and size of the crop before we execute it.

Step 8: Click the “toggle dialog” box on for the Crop

PhotoShop action pauseClick in the empty grey square next to the Crop step in the action. This tells PhotoShop “wait for my permission before completing this step”.

Step 9: Re-run the batch process

This time, PhotoShop will ask you to approve the position and size of the crop area before proceeding. It will save over the previous versions of the thumbnail files.

comments powered by Disqus

This site helps millions of visitors while remaining ad-free. For less than the price of a cup of coffee, you can help pay for bandwidth and server costs while encouraging further articles.