2

On a website that I maintain I am required to edit hundreds of images to have a certain canvas size. The images come in all different shapes and sizes. I am trying to figure out a way to automatically edit them so that I dont have to write ineffective AHK scripts to do it.

Is there a feature inside of Photoshop (cs3) to do this? I am more than willing to try different software.

Thanks guys!

1
  • try irfanview , it can do bulk resize
    – ukanth
    Nov 12, 2009 at 5:48

2 Answers 2

2

Install Imagemagick. It's a command line tool that can do this for you. Open a cmd window and cd to where your images are. The way to do set the canvas is a bit odd, but not too complex. You add add a border having a width/height half the size of the desired image size (resulting in an image that is too large), then crop the image to the desired size. Cropping respects gravity. Example:

convert 200x320.jpg -bordercolor white -border 200x160 
                    -gravity center -crop 400x320+0+0 400x320.jpg

You could wrap this command in a small script to convert many files at once (and account for file type differences if needed).

for %%f IN (*.jpg) do convert %%f ... -crop 400x320+0+0 out\%%f
1

Photoshop, menu File/Automate/Batch...

There, you can select the IN folder, and OUT one... You have a field to choose which Action (is like a macro, you previously must have created one) to perform over all the files in input folder.

Hit the button and that is it. It will take some minute, but thousand times faster than by hand: often also you need batch operation with psd layers and complex layer modes and groups kept, not possible with external programs.

There are many tutos in internet on how to make a Photoshop action, but basicly, you just hit certain "rec" button in Actions panel, type a name for the action, do whatever needed in Photoshop, and then hit stop bottom. You can then execute that action over any file, or set it in the "Automate" proccess I told you above. Just remember: when doing an action for this, you'd better not do very specific steps, that will not work for a bunch of different files, or may stop with an error.

For my video game graphics, I used this quite a lot, for sprites, tiles, etc. A life saver.

Like always, better if you use PNGs or PSDs as sources, you can include in a certain way the output as JPGs (for formats output I tend to prefer the mentioned here Irfanview, but all can be done. )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .