Automating Tasks


We've all made the following statement at some point in our lives: "For the price I paid for this computer, it should be making my coffee, too." Well, that might be asking too much, but it isn't too much to ask your computer to do repetitive tasks for you while you're busy refilling your mug with your favorite brew.

You'll be happy to know that Photoshop (along with its sibling apps, Illustrator and InDesign) has best-in-class support for scripting and automation. You'll also find plenty of scripts and features ready to go right out of the box.

Actions

So you're probably thinking, "Sure, automation is great and everything, but I don't knowor even want to knowhow to write in scripting language," right? Have no fear because Photoshop has something called Actionswhich require no knowledge of programming languages or any math, for that matter (I'm not a big fan of math).

The way it works is quite simple. You basically perform a set of operations once to show Photoshop what you want to do, and you save that sequence of events as an Action. Then whenever you want to perform that sequence of events again, you play the script and Photoshop performs all the steps for you.

For example, say you have a CD that you use often, which is filled with RGB stock photos. You can't use the photos as is, so each time you want to use one of these stock photos, you open the file, convert it to CMYK, change the resolution, and then save it as a TIFF. So you open the Actions palette and click the Create New Action button, name the file, and click the Record button. Then you open a file, convert it to CMYK, change the resolution, and then save the file as a TIFF, all as you would normally do. When you are finished, you click on the Stop Recording button in the Actions palette. And you're done.

The next time you need to use a photo from that CD, you can use the Action you recorded to do the conversion for you automatically. Now this might sound nice and all, saving you a few keystrokes, but it gets even better. You can apply an Action to an entire group of files at once, called batch processing. In this way, you can apply conversions to all the images on your CD automaticallyall while you go and grab some lunch.

To apply a batch Action, choose File, Automate, Batch. Then specify the Action and choose a source location (where the files are being opened from) and a destination location (where you want the adjusted files to be saved). This being Adobe Photoshop, of course, you also have many options on how to name new files and how to deal with dialog boxes and warnings (see Figure 5.134).

Figure 5.134. The Batch dialog box.


Scripts

Photoshop has built-in support for both AppleScript (used on Macintosh computers) and Visual Basic Script (used on Windows computers). If you are familiar with either of these scripting languages, you can tell Photoshop to do just about anything.

By the Way

Scripts and Actions differ in that Actions are simply a recording of specific keystrokes. Scripts can contain logic and perform functions based on different conditions. For example, in the Actions example mentioned earlier, a script could check what color mode the document is in and perform different functions depending on what the setting is. Scripts can also allow Photoshop to "talk" with other applications. For example, you could have a script do the file conversions, and then launch InDesign and place the photos into InDesign and print a catalog of images. Actions are limited to functions within the application.


If you're like me and can write a script as well as you can write a thesis on the advances of brain surgery in the twenty-first century, you're thinking that this scripting stuff won't be of much help in your everyday life.

Don't despair. Nowhere is it stated that to use a script, you have to write it yourself. Plenty of people write them and post them to the Web, sell them, or even make themselves available to write custom scripts for people. More important, Adobe includes several scripts with Photoshop that you can use right out of the box. You can find these by choosing File, Scripts.

Exporting Layers

The Export Layers to Files script is useful for when you want to create a separate file for each layer in your document. What's great about this script is that it can generate files in JPEG, Photoshop, TIFF, PDF, Targa, and BMP formats.

Exporting Layer Comps

We discussed earlier how layer comps can assist in keeping tabs on multiple design ideas within a single Photoshop document. To extend that functionality even further, Photoshop includes three scripts specifically designed for the layer comps feature. You can automatically generate separate files for each of your comps, create a multiple-page PDF file that contains all of your designs, or create a web photo gallery of your designs (which we discuss momentarily)all with a single command.

Photomerge

Some cameras are designed to shoot photos in panoramic mode, giving you a very wide view of such things as a landscape or a stadium. There's also a technique of using a regular camera to shoot a panoramic view in multiple photographs, which you can then "stitch" together in Photoshop. Photomerge is an automatic feature that attempts to create one single large file from a range of specified files by analyzing the edges of each of the pictures and aligning them where they match. Photomerge actually does a very impressive job, and, of course, you can touch up the final file as necessary, using Photoshop's other retouching tools.

Choose File, Automate, Photomerge to get the Photomerge dialog box. When you've chosen the source files (see Figure 5.135), click OK and watch as Photoshop does all the work (see Figure 5.136).

Figure 5.135. Specifying the source images to be merged.


Figure 5.136. The separate pictures (top) and the final merged image (bottom).


Crop and Straighten Photos

Scripts are cool, and watching scripts work right before your eyes is even cooler. One of the problems with scanning images on a flatbed scanner is that it's a pain to make sure that each photo is perfectly straight. It's also time-consuming to have to scan one picture at a time.

The Crop and Straighten Photos feature solves all of that by enabling you to cram several photos on your scanner at once and scan it as one large image. You also don't need to fret about whether the images are perfectly straight. Scan your photos and choose File, Automate, Crop and Straighten Photos. Then watch as Photoshop magically detects each photo, rotates it perfectly, and then puts each one into its own file.



Sams Teach Yourself Adobe Creative Suite 2 All in One
Sams Teach Yourself Creative Suite 2 All in One
ISBN: 067232752X
EAN: 2147483647
Year: 2003
Pages: 225
Authors: Mordy Golding

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net