5

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 Aug 12 '14 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 Aug 12 '14 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 Aug 12 '14 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 Aug 13 '14 at 5:00
  • 1
    I updated my answer to add color graphicdesign.stackexchange.com/a/37314/4338 – Brian Dillingham Aug 13 '14 at 16:10
3

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.
6

I have received a perfect answer at another (non-English) site, let me publish it here for those who may have the same question in future.

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

(the mogrify command is a part of ImageMagick)

  • 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 Aug 13 '14 at 2:19
  • I have IM 6.8.9 and got the error: mogrify: unrecognized option '-extend' @ error/mogrify.c/MogrifyImageCommand/4743 any recommendation? – Kostanos Nov 18 '18 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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