PDA

View Full Version : PS Help Please - Batch resizing


neil_r
29th of June 2004 (Tue), 11:28
I need to rezize well over 100 images. They are all different sizes and are a mixture of landscape and portrate. Is there any way I can write an action that will identify the longest side and resize that to a fixed size (the same size for all the pictures)

I have RTFM but can't find anything.

It's Photoshop CS

Many thanks

Neil

scottbergerphoto
29th of June 2004 (Tue), 11:45
I believe Qimage will do the resizing for you. It's available at www.ddisoftware.com.
Regards,
Scott

Scottes
29th of June 2004 (Tue), 11:47
Image Ready can use an action that will utilize the height and width info. So if it's wider than it is tall, do this, otherwise do that.

Photoshop itself can not do this - you'd have to create 2 actions - one for landscape and another for portrait - and then sort your images.

Either way, simply create the action(s) and then use the file browser to batch run that action on all files in a directory.

neil_r
29th of June 2004 (Tue), 12:15
Many thanks :)

N

Jesper
29th of June 2004 (Tue), 13:27
In Photoshop CS, you can do this with a script. Here is a script (written in JavaScript) that resizes the current document to 720 x 480 or 480 x 720, whichever dimension is largest.
doc = app.activeDocument

var startRulerUnits = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS

if (doc.width > doc.height)
doc.resizeImage(720, 480, doc.resolution, ResampleMethod.BICUBIC)
else
doc.resizeImage(480, 720, doc.resolution, ResampleMethod.BICUBIC)

app.preferences.rulerUnits = startRulerUnits

Save this in a file with the extension ".js" on your hard disk. To run it, choose File / Scripts / Browse... in PS CS and navigate to the file.

Scottes
29th of June 2004 (Tue), 13:37
That's pretty darn handy. Thanks Jesper.

chris.bailey
30th of June 2004 (Wed), 01:22
In Photoshop CS, you can do this with a script. Here is a script (written in JavaScript) that resizes the current document to 720 x 480 or 480 x 720, whichever dimension is largest.
doc = app.activeDocument

var startRulerUnits = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS

if (doc.width > doc.height)
doc.resizeImage(720, 480, doc.resolution, ResampleMethod.BICUBIC)
else
doc.resizeImage(480, 720, doc.resolution, ResampleMethod.BICUBIC)

app.preferences.rulerUnits = startRulerUnits


NICE ONE!
Save this in a file with the extension ".js" on your hard disk. To run it, choose File / Scripts / Browse... in PS CS and navigate to the file.

Cropduster
30th of June 2004 (Wed), 05:23
Thanks for the helpful script Jesper. Got any other good ones? :)

Jesper
30th of June 2004 (Wed), 13:24
:) Thanks...!

One more tip about scripts: if you put them in the following directory (Windows), they will appear in the File / Scripts menu the next time you start Photoshop CS, so you won't have to browse to it everytime you want to use it:

C:\Program Files\Adobe\Photoshop CS\Presets\Scripts

The above script is part of my "Prepare for Web" script, which I use to prepare my images for publishing on the web. I'll post the whole script below. This is what it does:

- Flattens the image
- Converts to the sRGB color space if necessary
- Converts to 8 bits per channel if necessary
- Resizes to either 720 x 480 or 480 x 720, depending on the orientation

doc = app.activeDocument

doc.flatten()

if (doc.colorProfileName.substring(0,4) != "sRGB")
doc.convertProfile("sRGB IEC61966-2.1", Intent.PERCEPTUAL, true, false)

if (doc.bitsPerChannel != BitsPerChannelType.EIGHT)
doc.bitsPerChannel = BitsPerChannelType.EIGHT

var startRulerUnits = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS

if (doc.width > doc.height)
doc.resizeImage(720, 480, doc.resolution, ResampleMethod.BICUBIC)
else
doc.resizeImage(480, 720, doc.resolution, ResampleMethod.BICUBIC)

app.preferences.rulerUnits = startRulerUnits

neil_r
30th of June 2004 (Wed), 13:58
Jesper,

I am really glad I asked the question.

Many thanks for this

Neil

dn7elson
30th of June 2004 (Wed), 14:46
Resizes to either 720 x 480 or 480 x 720, depending on the orientation

Assuming that the original image has been cropped or is otherwise not 720x480 in proportion does the script:
a) crash :D
b) crop the image to fit
c) stretch the image to fit

or something else?

Jesper
30th of June 2004 (Wed), 20:16
Resizes to either 720 x 480 or 480 x 720, depending on the orientation

Assuming that the original image has been cropped or is otherwise not 720x480 in proportion does the script:
a) crash :D
b) crop the image to fit
c) stretch the image to fit

or something else?

And the answer is..... C! (if it would be A, there would be something seriously wrong with Photoshop!).

720 x 480 has the same ratio, 3:2, as the 3072 x 2048 photos from my 10D. It's the size I use to publish my photos on the web.

Jesper
3rd of July 2004 (Sat), 13:19
Resizes to either 720 x 480 or 480 x 720, depending on the orientation

Assuming that the original image has been cropped or is otherwise not 720x480 in proportion does the script:
a) crash :D
b) crop the image to fit
c) stretch the image to fit

or something else?

I now posted a new version in a separate thread (http://photography-on-the.net/forum/viewtopic.php?p=244266#244266) that keeps the width / height ratio intact.

dn7elson
3rd of July 2004 (Sat), 19:47
Thanks Jesper. I can learn some Java with my PS :lol:

paulhillion
19th of December 2004 (Sun), 14:07
I now posted a new version in a separate thread (http://photography-on-the.net/forum/viewtopic.php?p=244266#244266) that keeps the width / height ratio intact.

Does anyone have a copy of this as the above link to the thread doesn't appear to be working.

Thanks.

Steven M. Anthony
19th of December 2004 (Sun), 14:41
I never used a script before. Do you select it as part of an action and then run it?

tumb
19th of December 2004 (Sun), 17:58
Scripts are ran from File>Script>. They can be either javascript, visual basic (windows), or applescript (mac). By default they are stored in the Presets/Scripts folder. You can do much more with scripts than with actions.

IainB
22nd of December 2004 (Wed), 14:27
And the answer is..... C! (if it would be A, there would be something seriously wrong with Photoshop!).

720 x 480 has the same ratio, 3:2, as the 3072 x 2048 photos from my 10D. It's the size I use to publish my photos on the web.

Does it work with PS7?
Iain

Unbearable
27th of June 2009 (Sat), 09:52
I have a question.

How to modify your script to save files in quality 8, discarding any information except the photo itself and using Optimized baseline?

Thank you

René Damkot
27th of June 2009 (Sat), 10:24
Bridge > Tools > Photoshop > Image Processor. Use "Fit image" to resize.

ziggy25
1st of May 2010 (Sat), 21:03
Does anyone have a copy of this as the above link to the thread doesn't appear to be working.

Thanks.

Where is this new version?

MT Stringer
1st of May 2010 (Sat), 21:22
Where is this new version?
That post is 6 years old! :-)