How do I resize image of multi-folder file without resizeImage?

387 views Asked by At

(see background for context)

I don't need to resize the photoshop file I am working on but I do need to resize the optimised images I am exporting. My problems would be solved if ExportOptionsSaveForWeb had image size properties!

Background I have a Photoshop file to manage the weekly images I need to produce for a show. Each folder is a week and each week there are about 5-6 folders which contain the layers for that image. Each week I export the 5-6 folders into 3 images of different sizes and place them into different folders according to their size. I've explored: Generate Image Assets, Image Processor and recording Actions with no luck so I am now trying scripting.

1

There are 1 answers

2
Mark Setchell On

You can do this pretty easily without all the complexity of Photoshop scripting by using ImageMagick which is installed on most Linux distros and is available for OS X and Windows.

The command to use is convert and you can put it in a Windows BATCH file or a small shell script on OS X. Say your completed, saved image is called image.psd, and you need to create 3 sizes - one in each folder of large, medium and small. The command would look like this:

convert image.psd[0] -resize 800x600 -write large/image.jpg  \
                     -resize 640x480 -write medium/image.jpg \
                     -resize 160x160 small/image.jpg

The \ are just line continuations, you can renove them and scrunch everything up together on one line - I just think it looks easier conceptually like I have written it.

If you started off with this image, that I examine using identify (also in the ImageMagick suite):

identify image.psd[0]

Output

image.psd[0]=>image.psd PSD 3675x4875 3675x4875+0+0 16-bit sRGB 1.1474GB 0.000u 0:00.000

you can see it is 3675x4875, and the smaller versions are as follows:

identify large/* medium/* small/*

Output

large/image.jpg JPEG 452x600 452x600+0+0 8-bit sRGB 195KB 0.000u 0:00.000
medium/image.jpg[1] JPEG 362x480 362x480+0+0 8-bit sRGB 166KB 0.000u 0:00.000
small/image.jpg[2] JPEG 121x160 121x160+0+0 8-bit sRGB 118KB 0.000u 0:00.000

P.S. Note that none of the above commands alter your original image in any way - they just create smaller versions of it.

P.P.S. If installing ImageMagick for the first time on Windows, or OS X, please ask for hints first...