I want to create an action to resize a photo to have a max dimension, say 720px. The problem is I have 2 actions at the moment, one to resize the X to 720 and one to resize the Y to 720.
Is there a way I can create a single action so the maximum size of either side of the image is 720?
Not that I'm aware of. But why is it a problem? You have, as you say, two actions, one for x-axis and one for y-axis, and all you need to do is point at the one or the other and click... I guess if you're trying to batch-process, maybe?
I edit a set of pics for my own web site and I want to then create a resized set for face book and a resized set for thumbnails.
I currently use a free too called "Easy Thumbnails" which is great and will do exactly that but sometimes I want to run another photoshop action as well
If you program just a little bit you can write a script in Javascript for photoshop, which will check on which is the longer dimension and then resize correctly. Then you don't have to actually select which is which.
If this is important to you, and you don't know how, I'd be happy to take a look at it this weekend & write something for you. What resolution do you need?
If you program just a little bit you can write a script in Javascript for photoshop, which will check on which is the longer dimension and then resize correctly. Then you don't have to actually select which is which.
I didn't realise you could do that, that's cool! I can write in Javascript, in fact I already have a script to check out image dimensions for something else so I'm sure with google I can work out how to put that into photoshop, cheers :)
After you write it, you just put the script in program files/adobe photoshop CSx/presets/scripts and the next time you run photoshop it will be available under File/Automate/Scripts.
Okay - I've seen this sort of question often enough, and the replies in this thread make it clear that some people are doing more work than they have to, so I wrote a little program. The javascript is below this.
All you have to do is copy the javascript (or you can pm me with your email address & I'll send you the file) into a text editor & save it as a file (e.g., "ResizeDocs.jsx") in program files/adobe photoshop CSx/presets/scripts. I've only tested it in CS4, so I can only state that it works with that version for sure.
Anyway, you can change the bolded line below from "720" to any number you want.
The program will take the active document, modify it so that the largest dimension is 720 (or whatever number you modified it to), resampling with bicubic sharper if downsizing, or bicubic smoother if upsizing, as recommended by Adobe.
When you restart Photoshop, this script will be available under "file/scripts". It works on the active document. If you want to work in batches, then you can do the following (BTW - I'd love to know if anyone has a better way of doing this!!!!)
Record an action called "Resize Images" and let the action do just one thing: call & run the script. Then that action can be used for batch actions.
Here's the javascript:
///////////////////////////////////////////////////////////////////////////////
//ResizeDocs.jsx
//Resize so that largest dimension is X pixels wide
//copyright 2009 Beryl vdb
///////////////////////////////////////////////////////////////////////////////
//User should set the constant below:
///////////////////////////////////////////////////////////////////////////////
const targetPixels=720;
///////////////////////////////////////////////////////////////////////////////
//PROGRAM AREA - USER SHOULD NOT CHANGE ANYTHING BELOW THIS
///////////////////////////////////////////////////////////////////////////////
//assign variables
var startRulerUnits;
var startTypeUnits;
var startDisplayDialogs;
///////////////////////////////////////////////////////////////////////////////
// Functions
///////////////////////////////////////////////////////////////////////////////
function main()
{
//collect dialog defaults so that the program can set them back afterwards
startDisplayDialogs = displayDialogs;
startRulerUnits = preferences.rulerUnits;
startTypeUnits = preferences.typeUnits;
//collect the height, width & resolution of the active document
var activeDoc = app.activeDocument;
var docHeight= activeDoc.height;
var docWidth = activeDoc.width;
var docRes = activeDoc.resolution
var docRatio = docWidth / docHeight;
if (docHeight > docWidth) {
docRatio = docHeight / docWidth;
newHeight = targetPixels;
newWidth = ((1.0 * newHeight) / docRatio)
newWidth = Math.round(newWidth); // make integer
//sizing up or down?
if (docHeight > targetPixels) {
downSizing = true
}
}
else {
docRatio = docWidth / docHeight;
newWidth = targetPixels;
newHeight = ((1.0 * newWidth) / docRatio)
newHeight = Math.round(newHeight); // make integer
//sizing up or down?
if (docWidth > targetPixels) {
downSizing = true
}
}
Ew - I just noticed that the forum took away all my nice formatting with tabs & spaces - it will still work, but it's not as nice as it should be. Just pm me if you want me to send you the file.
I just use Photoshop's Automated Web Gallery to create my images. It allows you to put in a max size for both X & Y. Plus you can give it the jpg compression percentage, copyright notice, and thumbnails(which can be sized as well). I just toss out the web pages when its done.
Russell Brown has tons of stuff on his site. The CS2 version of his Services has a 1-2-3 Process download that does work in CS3 also. Plus many other things. Just page down to the CS2 stuff and you will see Services 1.5.1
[b][quote=Bebe] Okay - I've seen this sort of question often enough, and the replies in this thread make it clear that some people are doing more work than they have to, so I wrote a little program. The javascript is below this.
All you have to do is copy the javascript (or you can pm me with your email address & I'll send you the file) into a text editor & save it as a file (e.g., "ResizeDocs.jsx") in program files/adobe photoshop CSx/presets/scripts. I've only tested it in CS4, so I can only state that it works with that version for sure
It works in CS3.
Thanks[i]
Okay - I've seen this sort of question often enough, and the replies in this thread make it clear that some people are doing more work than they have to, so I wrote a little program. The javascript is below this......
Awesome, works a treat in CS3, huge thanks :)
eta, your javascript programming is much neater than mine, you have error trapping and everything, lol
Bebe,
Thank you for your script. It worked well in CS4, but I can't get it to work in CS5. I can save is as a .jsx in the .../presets/scripts location, but it doesn't appear under File- Scripts after I restart photoshop. If I try to browse to it, Photoshop doesn't show it. CS5 seems to only show Adobe Java script files.
***********************************
Nevermind!!! I was another victim of long file names. I fixed it!
although i see this is already taken care of... if you use a mac you could use the automator to configure a folder action that resizes to a given bounding box (720 x 720) and saves as JPG. i have my portfolio actioned so that whenever i put a new photo in it the photo is copied to a web folder where it is resized and saved to JPG so that i am ready to upload.
I just came across this post (sorry for posting to an old thread) and wanted to say thanks to Bebe for putting up the script... it worked like a charm in CS5! I made a minor tweak to the script to allow me to specify the output resolution as well as the size. Here is Bebe's script with the changes, in case someone wants that functionality:
///////////////////////////////////////////////////////////////////////////////
//ResizeDocs.jsx
//Resize so that largest dimension is X pixels wide @ Y resolution
//copyright 2009 Beryl vdb
///////////////////////////////////////////////////////////////////////////////
//User should set the constants below:
///////////////////////////////////////////////////////////////////////////////
const targetPixels=800;
const docRes = 72; // Picture resolution in pixels
///////////////////////////////////////////////////////////////////////////////
//PROGRAM AREA - USER SHOULD NOT CHANGE ANYTHING BELOW THIS
///////////////////////////////////////////////////////////////////////////////
//assign variables
var startRulerUnits;
var startTypeUnits;
var startDisplayDialogs;
///////////////////////////////////////////////////////////////////////////////
// Functions
///////////////////////////////////////////////////////////////////////////////
function main()
{
//collect dialog defaults so that the program can set them back afterwards
startDisplayDialogs = displayDialogs;
startRulerUnits = preferences.rulerUnits;
startTypeUnits = preferences.typeUnits;
//collect the height, width & resolution of the active document
var activeDoc = app.activeDocument;
var docHeight= activeDoc.height;
var docWidth = activeDoc.width;
//var docRes = activeDoc.resolution
var docRatio = docWidth / docHeight;
if (docHeight > docWidth) {
docRatio = docHeight / docWidth;
newHeight = targetPixels;
newWidth = ((1.0 * newHeight) / docRatio)
newWidth = Math.round(newWidth); // make integer
//sizing up or down?
if (docHeight > targetPixels) {
downSizing = true
}
}
else {
docRatio = docWidth / docHeight;
newWidth = targetPixels;
newHeight = ((1.0 * newWidth) / docRatio)
newHeight = Math.round(newHeight); // make integer
//sizing up or down?
if (docWidth > targetPixels) {
downSizing = true
}
}