Mobile app version of vmapp.org
Login or Join
Samaraweera207

: How to batch resize canvas of multiple files placing the original pictures in the centers? I have got some hundreds of pictures of different shapes. For example one is 600x600, another is 307x600,

@Samaraweera207

Posted in: #Alignment #BatchProcessing #Canvas #Resize

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.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Samaraweera207

2 Comments

Sorted by latest first Latest Oldest Best

 

@Kimberly620

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.

10% popularity Vote Up Vote Down


 

@Samaraweera207

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)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme