I have got some hundreds of pictures of different shapes. For example one is 600x600, another is 307x600, the third is 600x400, the fourth is 500x300. What I need to turn them all into 600x600 (or 610x610 perhaps to add some reasonable padding) files placing the original pictures into centers of the new pictures (rather than scaling them or placing them near the edges). The only application I know capable of this is Paint.Net but it features (AFAIK) no automation facilities so processing hundreds images is nasty. Any way to do this in batch? Windows and Linux solutions welcome. An opportunity to specify the colour (including an option of PNG empty colour) to fill the canvas space added is highly desirable.

enter image description here

  • Use imagemagick.
    – joojaa
    Commented Aug 12, 2014 at 14:23
  • @joojaa I have taken a look at the ImageMagick site download section and it says there are 16 and 8 bits-per-pixel versions. Although I have made a simplistic picture that can fit into these constraints for an example, I actually need to process 32 (or 24, I am not sure) BPP photographic quality pictures actually.
    – Ivan
    Commented Aug 12, 2014 at 14:32
  • 1
    You have misunderstood 16 bits per channel is 48 or 64 bpp 8 bits per channel is 32 or 24 bpp. Diferent metric. Understandable confusion.
    – joojaa
    Commented Aug 12, 2014 at 14:41
  • 1
    Read the paragraph text above and they CREARLY state 8 bits-per-pixel component == per channel. Full text: "Versions with Q8 in the name are 8 bits-per-pixel component (e.g. 8-bit red, 8-bit green, etc.), whereas, Q16 in the filename are 16 bits-per-pixel component." italics and bold mine. We changed language once it became apparent images can have many channels.
    – joojaa
    Commented Aug 13, 2014 at 5:00
  • 1
    I updated my answer to add color graphicdesign.stackexchange.com/a/37314/4338 Commented Aug 13, 2014 at 16:10

3 Answers 3


If you have ImageMagick installed, you can use the mogrify command to batch-process an entire folder. It will allow you to resize the canvas of each image, centering the original image within this new dimension, and filling the background with a color (or transparency).

For handling a directory of JPGs, and using white as the background:

mogrify -extent 640x640 -gravity Center -fill white *.jpg

For PNGs, and having a transparent background:

mogrify -extent 300x300 -gravity Center -background none *.png
  • BTW although ImageMagick distributions are labelled as 8/16 bits per pixel they (I have tried the 16 bits per pixel version) seem to work with TrueColor pictures just fine.
    – Ivan
    Commented Aug 13, 2014 at 2:19

You can do this with actions & the batch automation feature within Photoshop. To accomplish a colored or transparent background with new size dimensions, you'd create an action set (folder icon) and create an action within that set for each color you're looking to batch.

Step 1: Create the action

Record yourself resizing the canvas for future automation

  • Navigate to the actions panel or Alt+F9
  • Create a new action by clicking the layer icon on the actions panel
  • Do the actions you want automated
  • Click the stop icon on the actions panel

While recording your specific action: (with image open)

  • Go to Image > Canvas Size and change to 610x610
  • Add a square shape for background
  • Change color of shape to desired color / make no background for transparent
  • Move beneath your image

Repeat this, creating a new color action within your action set as desired

Step 2: Setting up a batch automation

Tell Photoshop which folder of images to apply your re-sizing action to

  • Go to File > Automate > Batch
  • 'Play' section, choose your newly created action
  • 'Source' section, choose a folder of images to apply this action to
  • 'Destination' section, choose a folder where the newly re-sized images should output.
  • Click Ok and your automation will begin immediately.

Side Notes:

  • Changing the canvas size will center image within the new dimensions.
  • Custom actions record the things you do in Photoshop, in this case re-sizing.
  • 'Action Sets' in the batch dialog are folders or groups of actions in the actions panel.

A slightly modified answer, to make it a complete answer.

  • Install ImageMagick via terminal.

  • Resize all the images in the folder you want to change, to a sample size, e.g.:
    magick mogrify -resize 256x256 *

  • then run
    mogrify -extent 300x300 -gravity Center -fill white *

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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