Blog

Last updated on .

How to: Batch Resize Images

When working with sets of images, it's very common to resize them to fit inside a document, webpage, email, etc. This can be a tedious practice if you have to resize more than one. Phoduit makes this process much faster by performing batch processing. We'll cover the entire process of how to scale an image and then how to extend the process to quickly scale an entire set of images. If you are new to Phoduit, check out the free trial. This how to assumes you have some familiarity with Phoduit and have worked through the getting started page first.

Setting Up The Graph

Start a new Phoduit document and insert an image from the set that you want to resize. You can either insert an Image Open node (located under Input on the Nodes Toolbar at the top) or drag & drop the image from your file manager into the graph. Strictly speaking, you only need an Image Open node to resize a batch of images but opening an image from your set makes it easier to see what your changes are doing.

Insert an Image Open node

Next, insert a Scale node. It's located under Geometry on the Nodes Toolbar at the top. This is the only node you need to resize an image. Connect the output (right side) of the Image Open node to the input (left side) Scale node and then connect the output (right side) of the Scale node to the input (left side) of the Render node.

Insert a Scale node

The Scale node has many different fields which are used to change the size and quality of the outputted image. It's worth understanding what each one does but you'll often find that you only need to set everything once. Then, you can save a .phoduit file as a template that you can reuse later.

Scale node

The first field is the Unit field. This is the unit that the width and height of your output image is specified in. It can be set to Percentage or Pixels. Percentage is relative to the input size of the image. For example, if you want to make your image twice as large, set the width and height to 200%. When set to Percentage, the output size is displayed below the Width and Height fields in pixels. Setting the Unit field to Pixels is used to set an exact size in pixels. If you don't know what pixels are, check out What is an image.

Below are the Width and Height fields used to specify the output size in the unit set above. If your image does not appear to change size as you change these fields, it's probably because you have the Canvas Zoom set to Fit on the Status Bar at the bottom. In this case, your image image is being resized correctly, but it's filling your screen for preview purposes. Set the Canvas Zoom to 100% to see the real size of your image.

Example: Scale by 200%

To the right of the Width and Height fields is the Link button. It toggles locking the ratio between the width and height. When this is locked (the default), changing either the Width or Height fields will change the other to keep the same ratio. Toggle this button to the unlocked state to change these fields individually.

Link button

If at anytime you want to return the Width and Height fields to match the input image's size, click the "Reset Size" button.

The Aspect Ratio field is a useful field when batch processing images. By default, it's set to Ignore which means the Width and Height fields can be set individually so that the scaled image can appear squished or stretched. Sometimes, you might want this, but it's more common to want all of your images to fit within a maximum space. This can be accomplished by setting Aspect Ratio to Keep. This prevents your images from becoming distorted and also makes them no bigger than the size specified. The Expand option is similar to Keep in that your images will not be distorted. The difference is Expand scales your images to completely fill the size specified.

Comparison of aspect ratio options

The final field in the Scale node is the Method field. It's used for controlling the quality. There are three different choices, each becoming progressively slower but also producing a higher quality result. Most of the time, you'll want to leave this set to the highest quality option, Bicubic (the default). See below for a comparison of the different methods.

Comparison of scaling methods

If you're working with photographs, instead of graphs or drawings generated on a computer, it's highly recommended that you apply some sharpening after scaling. It's simple and dramatically improves the results. Just insert an Unsharp Mask node (located under Filter on the Nodes Toolbar at the top) between your Scale and Render nodes. Make sure you adjust the Scale node first so you can figure out how much sharpening is required. For a detailed description of the Unsharp Mask node, see the Sharpening page.

Comparison of not sharpening and sharpening after scaling

Batch Processing

Batch processing lets you take a graph, like the one you just built, and use it to process multiple images the same way. It's started by clicking the File menu at the top and then by selecting "Batch Process Images...". You'll see a dialog that is split into two parts. The top part is used for setting which images you want to be processed and the bottom part is used for specifying how the resulting images should be saved.

Batch processing dialog

There are three ways to to add images to be processed. The first is to click the "Add Images..." button in the top right and then select them individually using the dialog. A faster but less precise method is to click the "Add Directory..." button and select the directory containing your images. The selected directory is searched recursively for all compatible images. The final method is to drag & drop images into the table (left of the "Add Images..." and "Add Directory..." buttons) from your file manager. Each image you've added is listed in this table, along with the name that the resulting image will be saved as (more on this in a moment), a thumbnail of the image, and a preview of the processed image.

Add images to be batch processed

After you've selected which images you want to process, you need to select where you want to save them. Click the "..." button to the right of the Directory field and then select the directory you want to save to. It's a good practice to make this a different directory than where your input images are stored. This way you can quickly make changes and reprocess everything, if need be, without having to worry about accidentally overwriting anything.

Set the output directory

Each resulting image must be given a unique name to be saved as. The name can be any combination of the original file name, a sequence number, the date and time, and more. As an example, to name image product.jpg as product_scaled.jpg, click the "New" button in the Name field. Then change the first field to "String" and "Original File Name". Next, change the second field to "String" and "Custom". Finally, enter "_scaled" into the text field to the right. Look in the Output File Name column of the above image table to see if it matches what you're expecting. If you want to re-order or remove a field, click the arrow or X buttons to the right, respectively.

Set the output file name format

The final thing you need to do is select the format you want to save the resulting images in. The formats available, as of this writing, are JPEG, PNG, and TIFF. The differences between these formats and their various options are covered in detail on the Export Image page.

Set the output file format

Batch processing works by taking each of the images you've selected and inserting them into the Image Open node in your graph. The graph is then processed and the resulting image, the one connected to the Render node, is saved. If you have more than one Image Open node, you can select which one is used by clicking the Graph tab at the top. For the graph you built above, there's only one Image Open node, so this doesn't matter. Just keep this in mind when you build more complicated graphs.

Once you're done setting everything up, click the "Batch Process" button at the bottom and Phoduit will process all of your images. A loading bar will be displayed and you'll be prompted once complete. The amount of time it takes varies based on the size of the selected images, what and how many nodes are in your graph, and what file format you are saving with.

Phoduit makes batch resizing images very quick and easy. You can extend this process with more nodes to do different and more complicated types of batch processing. If you have any questions, post a comment below or reach out on Twitter to @Phoduit!

Comments

Comments are closed.