The script we're making here is going to operate on the current document in Photoshop (that is, the one that's selected when we run the script). If Photoshop was already open when you first saved the script file, you'll need to restart Photoshop to make the script appear in the Scripts menu. Once you have your script saved in the right folder, you'll be able to select it in Photoshop via a menu by going to File → Scripts → Image Resize and Export. This is a special editing program made by Adobe for scripting Photoshop (and Illustrator, InDesign, etc.). For a text editor, you might look and see if you have ExtendScript Toolkit installed. This file is where we'll be putting the code that follows. On my mac, that folder is located at /Applications/Photoshop CS2/Presets/Scripts. Create a file in a text editor called "Image Resize and Export.jsx", and save it in your Photoshop CS2 Presets/Scripts folder. What follows is a run-through of a basic script for Photoshop CS2 for doing conditional resizing of images, as well as some basic cleanup and export.įirst, a brief intro to how to set up a script for Photoshop CS2. Photoshop CS2 provides a way to write scripts in JavaScript (and AppleScript, but I'm not going to cover that here) to automate all kinds of behavior. Resizing portrait- and landscape-oriented images to fit within a square space. But where actions fail, JavaScript comes to the rescue. I've never found a good way to do this with a single action. If it's landscape-oriented, then I should resize proportionally with a 500 pixel width, instead of height. If the image is portrait-oriented, then I need to resize proportionally, setting the height to 500 pixels. For example, let's say I have a big batch of images, some portrait-oriented (taller than they are wide) and some landscape-oriented (vice versa), and I want to resize each of them to fit within a 500 x 500 pixel square. However, the shortcoming I've found with actions is their lack of conditional behavior. In Photoshop, you can use actions to help you automate a lot of repetitive work. It can be the most mind-numbing part of my work, and I'm always looking for ways to avoid that. Often I find myself having to do a lot of bulk image processing when I'm working on websites: resizing a bunch of pictures to a certain width or height, color adjustments, and sharpening, usually. Conditional Image Resizing with Photoshop and JavaScript
0 Comments
Leave a Reply. |