DPChallenge: A Digital Photography Contest You are not logged in. (log in or register
 

DPChallenge Forums >> Tips, Tricks, and Q&A >> Resize Action in CS3 for portrait OR landscape
Pages:  
Showing posts 1 - 22 of 22, (reverse)
AuthorThread
02/20/2009 08:52:14 AM · #1
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?

cheers
Robert
02/20/2009 09:06:11 AM · #2
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?

R.
02/20/2009 09:11:04 AM · #3
Originally posted by Bear_Music:

I guess if you're trying to batch-process, maybe?


Exactly :)

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
02/20/2009 09:15:55 AM · #4
I have solved this by creating one action for each axis, and then using Bridge as the source for the batch.

Just select all of your landscape orientation shots and go to "tools->photoshop->batch" in Bridge, then do the same for portraits.

Message edited by author 2009-02-20 09:16:17.
02/20/2009 09:22:49 AM · #5
Originally posted by shalrath:

I have solved this by creating one action for each axis, and then using Bridge as the source for the batch.

Just select all of your landscape orientation shots and go to "tools->photoshop->batch" in Bridge, then do the same for portraits.


That's a good idea
02/20/2009 09:29:52 AM · #6
I put the vertical shots in one folder, and the horizontal in another, then use the batch function.
02/20/2009 09:37:24 AM · #7
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?
02/20/2009 09:42:25 AM · #8
Originally posted by Bebe:

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 :)
02/20/2009 09:46:46 AM · #9
Check out this thread:

http://www.dpchallenge.com/forum.php?action=read&FORUM_THREAD_ID=804696

Here are Adobe's javascript manuals:

CS2
CS3

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.

Message edited by author 2009-02-20 09:48:16.
02/20/2009 09:53:50 AM · #10
Fantastic, thanks for that :)
02/20/2009 01:53:34 PM · #11
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;

var downSizing = false

///////////////////////////////////////////////////////////////////////////////
// Dispatch
///////////////////////////////////////////////////////////////////////////////
try {
main();

///////////////////////////////////////////////////////////////////////////////
// Functions
///////////////////////////////////////////////////////////////////////////////
function main()
{
//collect dialog defaults so that the program can set them back afterwards
startDisplayDialogs = displayDialogs;
startRulerUnits = preferences.rulerUnits;
startTypeUnits = preferences.typeUnits;

//set dialogs
displayDialogs = DialogModes.NO;
preferences.rulerUnits = Units.PIXELS;
preferences.typeUnits = TypeUnits.PIXELS;

//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
}
}

if (downSizing) {
resampleMeth = ResampleMethod.BICUBICSHARPER;
}
else {
resampleMeth = ResampleMethod.BICUBICSMOOTHER;
}


activeDoc.resizeImage(newWidth, newHeight, docRes, resampleMeth)

//reset preferences to original
preferences.rulerUnits = startRulerUnits;
preferences.typeUnits = startTypeUnits;
displayDialogs = startDisplayDialogs;

activeDoc = null;

} //end function main

} //end trry

catch(e) {
alert( e );

if ( undefined != startDisplayDialogs ) {
displayDialogs = startDisplayDialogs;
}

if ( undefined != startRulerUnits ) {
preferences.rulerUnits = startRulerUnits;
}

if ( undefined != startTypeUnits ) {
preferences.typeUnits = startTypeUnits;
}

}

Message edited by author 2009-02-20 14:23:27.
02/20/2009 01:55:04 PM · #12
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.
02/20/2009 02:27:51 PM · #13
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.

Message edited by author 2009-02-20 14:28:15.
02/21/2009 02:13:47 AM · #14
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
02/21/2009 03:26:34 PM · #15
[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]
02/22/2009 10:04:18 AM · #16
Originally posted by 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......


Awesome, works a treat in CS3, huge thanks :)

eta, your javascript programming is much neater than mine, you have error trapping and everything, lol

Message edited by author 2009-02-22 10:08:28.
02/22/2009 10:08:51 AM · #17
Glad to be of help!
09/29/2010 01:01:37 AM · #18
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!


Message edited by author 2010-09-29 01:05:21.
09/29/2010 01:47:30 AM · #19
Originally posted by jeger:

I put the vertical shots in one folder, and the horizontal in another, then use the batch function.


Yep, that's what I do also.
09/29/2010 02:28:16 AM · #20
Man! How did I miss this when it came up!?
Awesome, thanks a lot for this. I knew there had to be a way.
09/29/2010 09:39:04 PM · #21
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.

-Max
08/24/2011 06:33:21 PM · #22
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;

var downSizing = false

///////////////////////////////////////////////////////////////////////////////
// Dispatch
///////////////////////////////////////////////////////////////////////////////
try {
main();

///////////////////////////////////////////////////////////////////////////////
// Functions
///////////////////////////////////////////////////////////////////////////////
function main()
{
//collect dialog defaults so that the program can set them back afterwards
startDisplayDialogs = displayDialogs;
startRulerUnits = preferences.rulerUnits;
startTypeUnits = preferences.typeUnits;

//set dialogs
displayDialogs = DialogModes.NO;
preferences.rulerUnits = Units.PIXELS;
preferences.typeUnits = TypeUnits.PIXELS;

//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
}
}

if (downSizing) {
resampleMeth = ResampleMethod.BICUBICSHARPER;
}
else {
resampleMeth = ResampleMethod.BICUBICSMOOTHER;
}

activeDoc.resizeImage(newWidth, newHeight, docRes, resampleMeth)

//reset preferences to original
preferences.rulerUnits = startRulerUnits;
preferences.typeUnits = startTypeUnits;
displayDialogs = startDisplayDialogs;

activeDoc = null;

} //end function main

} //end trry

catch(e) {
alert( e );

if ( undefined != startDisplayDialogs ) {
displayDialogs = startDisplayDialogs;
}

if ( undefined != startRulerUnits ) {
preferences.rulerUnits = startRulerUnits;
}

if ( undefined != startTypeUnits ) {
preferences.typeUnits = startTypeUnits;
}

}

Pages:  
Current Server Time: 09/19/2017 08:44:28 AM

Please log in or register to post to the forums.


Home - Challenges - Community - League - Photos - Cameras - Lenses - Learn - Prints! - Help - Terms of Use - Privacy - Top ^
DPChallenge, and website content and design, Copyright © 2001-2017 Challenging Technologies, LLC.
All digital photo copyrights belong to the photographers and may not be used without permission.
Proudly hosted by Sargasso Networks. Current Server Time: 09/19/2017 08:44:28 AM EDT.