Resize image canvas to a given w:h ratio

1536 views5 repliesLast post: 5/17/2007
Hi all,

I've been trying to work out a way of resizing an image canvas to match a given width:height ratio.

eg, a ratio of 1.25:1, if I give it a file that is 80 * 80, it will pad out the width with white space until the image is 100 * 80

I want to batch process this for completely different size files, so need to work out how to do it automatically within photoshop (rather than manually calculating the size required and simply resizing the canvas).

It would be possible if in the "relative" resize option we could select relative to the other measure (eg, width relative to heigh and vice versa) rather than just relative to itself... Maybe this needs to be in the feature request?

I would have thought this would be reasonably common a need, but I can't find how to do it!
#1
David,

Are the initial width and height always equal to each other as in your example? I really don't think that is your intent but if perhaps it is, use percent for the units of width and height in the canvas size dialog box and enter 125 for width and 100 for height.

George
#2
george,

unfortunately they aren't... that was just an example. A real life example, one of my images is 100 x 402. In photoshop I can simply change the canvas to 503 x 402, which does the job. However, the next image I do might be 402 x 100, and soo I need to change the height rather than the width...
#3
Excellent, thanks Phos. That will do it for me!

This is how I've done it:

1) Save an action that resizes the image to a certain width (eg, 503px in my case)
2) Save an action that resizes the canvas to a certain height (eg 402px)

3) Create a new action submenu, and do the opposite of above (resize the image to a certain height, then resize the canvas to a certain width).

Then using Phos' above mentioned conditional script automater, you can specify which of the two action subsets to run.

This works for me because my images are LARGER than 503x402 (which is what I'm resizing them to), and because I know that all of them are larger. However, if you have images that were smaller, then it prob wouldn't work particularly well...

I still think that providing an option in the relative canvas resizing to resize relative to the other measure (height relative to width etc) would be a great feature. Given how photos need to be printed in different ratios, etc it sure would be handy!
#5
Even easier, use "fit image" to resize the image, then use canvas size to add the borders you need
#6