![]() |
| |||||||
| Photoshop Scripting Learning and sharing for all platforms |
| | Thread Tools |
|
#1
| ||||
| ||||
| Script to Detect Upright and View images Let's assume I have a CD full of pictures. All the pictures are different sizes some are upright and some are view, some may even be square. (But they are all correctly orientated) What I would like to do is create a batch file to: Find the longest side and reduce (or enlarge) it to 600 pixels Pad out the shortest side to 600 pixels with a white background Save the new square image to a new folder I guess I need something like this Code: if (activeDocument.width > activeDocument.height) {activeDocument.resizeImage(null, null, activeDocument.width/longside, ResampleMethod.BICUBICSMOOTHER); }
else
{activeDocument.resizeImage(null, null, activeDocument.height/longside, ResampleMethod.BICUBICSMOOTHER); }
I also found this http://ps-scripts.com/bb/viewtopic.php?=&p=2524 but I can't get that working either Thanks for your help Ken. |
|
#2
| ||||
| ||||
| Re: Script to Detect Upright and View images For what you're trying to accomplish and considering "are all correctly orientated," I believe an action will do it. Try the one attached. Does this work for you? |
|
#3
| ||||
| ||||
| Re: Script to Detect Upright and View images Hi Danny. Thanks for your help. The action you have created does work. I did not realise this would be possible with an action. I assumed I would need script. The big advantage of script over actions is that they are very easy to edit. Although I am not sure if it's possible to use scripts and batch together. As you may have guessed this is for web page pictures. Square images are much easier to handle. I simplified my question because I thought I could just alter the script for different sized images but I also need thumbnail and medium images as well. And actions are not easily editable. Please could I trouble you for an explanation so that I can 'read' this and recreate it for the other sizes of images. Where do I find 'Fit Image'? Will I be able to set 72dpi? Will I be able to save with different names? Or should I save with Batch. Sorry I'm not good with actions. (or scripts, or Batch) ![]() Ken. Last edited by Cameraken; 01-06-2008 at 07:06 PM. |
|
#4
| ||||||
| ||||||
| Re: Script to Detect Upright and View images Quote:
Quote:
Quote:
The other challenge is script compatibility, or lack thereof, of a given script across versions. Since PS7 Adobe has "upgraded" the JS libraries a couple times which amounts a script written under PS 7 may or may not run under CS, CS2 or CS3 and vice versa, which is probably what bit you here. Once a script is working I agree that changing command settings can usually be done easily in Notepad or other text editor. Quote:
The other way is to write your own or use a pre-written script that is fully functional and independent, like "Image Processor" (a JS installed starting with CS, or maybe it was CS2). These types of scripts don't need Batch. The script dialog is similar to Batch where one specifies Source and Destination folders and other script-specific options. Quote:
Quote:
Option A: I found this site that has specific If-then-else JS code for PS7. http://www.hanfordlemoore.com/photoshop/index.htm Option B: If that does not work for you and/or you want to spell out all the specifics of where you want to go/what you want to do, perhaps a couple actions would be the way to go. * Specific image sizes, e.g., 600 px x 600 px - What others? * (new) File name examples * anything else you can think of I'll be glad to help if I can. |
|
#5
| ||||
| ||||
| Re: Script to Detect Upright and View images Hi Danny. I found 'Fit Image' I have never used that before. In fact I've never even seen it before. It's amazing that I can use this program for years and still not be aware of all the features. I've also added a Image > Image size Which changes the pictures to 600 x 600 @ 72 dpi (8.333" x 8.333") So this is working perfectly. I can now make two more actions for my medium and small sized images. Quote:
However by making three actions for the three different image sizes means that they should not need altering in the future, which solves the problem. Thanks for the link to the script. A script to decide which action to run. It certainly opens up more possibilities. Thanks for all your help Danny. Ken. |
| Thread Tools | |
| |