Skip to main content
December 1, 2016
Question

How to batch resize multiple images into squares?

  • December 1, 2016
  • 1 reply
  • 3912 views

Hi!

So I have several hundred images that are of varying sizes from 600x1000 pixels to 4000x1000 pixels. So I want to make them all into square images. So far I have only figured out how to automate by recording actions changing the canvas size to a set amount, ie I change the 600x1000 to 1000x1000 which works but doesn't work for the 4000x1000 image. If I changed them all to 4000x4000 then the smaller images would be in to small of a square. Is there anyway to change the canvas size in a way that I don't have to specify the exact size and use a more fluid/relative method?

Hopefully this makes sense!

This topic has been closed for replies.

1 reply

JJMack
Community Expert
December 1, 2016

Action are recorded Photoshop step. In Adobe added conditional action support a while back where an action cap play(call) other action in the action set the action  is in depending on some conditions.  Actions can test some document conditions and some layer conditions.  And that is all the logic action can muster on their own.  They  can not retrieve information like document  width and document height and use that that information to deal with size.   There few conditions the can test.

Photoshop has an additional automation feature Photoshop Scripting. Actions can use Scripts and Scripts can do Photoshop Actions.

Photoshop Scripts can use logic and can easily do what you want to do.  However scripting is programming you have to program Photoshop Scripts using a scripting language like JavaScript.

What you want to do is simple program.

If document width is greater than document height  canvas size width=document_width  height=document_width

else canvas size width=document_height height=document_height.

Square document canvas sized will not change.   Landscape and portrait document canvas sizes will change canvas will be added to make the document square.

Write that script. Record an action menu File>Scripts>ScriptName then batch that action.

.

JJMack
December 1, 2016

Thanks for the help! I am not fluent with scripting. Are any scripts already created that you know of? Or do I have to find someone to write the code?

JJMack
Community Expert
December 1, 2016

If you want to automate process that require some logic it would be a good idea to learn a little about scripting Photoshop.   I have a programming background.  However I also have some disabilities.   I can not type and a do not know JavaScript.   But I'm also a featless hacker.  It would be nothing to hack that script for you.  However I'm not going to.  That is something you should learn to do. Start here Tutorials > Scripting Photoshop, Part 1 — An Introduction | Trevor Morris Photographics

Tutorials > Scripting Photoshop, Part 2 — A Practical Example | Trevor Morris Photographics

he has easy well commented sample you can learn from. It may sound scary programming but it is not actually hard.

Adobe Photoshop Scripts | Trevor Morris Photographics

Here is a video I made to show how one of my scripts work.  Hopefully it will give you an idea what you can do with Photoshop scripting. http://www.mouseprints.net/old/dpr/Populate911_720p.mp4

JJMack