![]() bears the title JavaScript Scripting Reference. Then open the subfolder called Scripting Guide and double-click JavaScript Reference Guide.pdf to open it in Adobe Reader, Acrobat, or Preview on the Mac. Locate the folder on your hard disk that contains the Photoshop application. But how do we know what that is? By consulting the dense, sometimes infuriating, but ultimately essential JavaScript Reference Guide, a 335-page PDF document that ships with Photoshop. Now we need to enter the code that deletes the alpha channels. STEP 6 Open the JavaScript Reference Guide enable double-clicking from the Macintosh Finder or the Windows Explorer While not absolutely necessary, this code ensures that the script works even when called from another program. The others (which you must enter exactly as written) switch the operating system’s attention to Photoshop and make Photoshop the active application, in that order. The two lines that begin // are comments. Now press Return (PC: Enter) twice, then enter the above lines of code. This script deletes all alpha channels from an image. Deke and Daniel McClelland, authors of this little honey We started our script with the copyright statement, author credits, and description shown below. Any ignored code is considered a comment, which ExtendScript Toolkit formats in magenta. To ignore multiple lines, start the lines with /* and end them with */. ![]() Like all JavaScript-savvy applications, Photoshop ignores any line of code that begins with two forward slashes. ![]() It’s tempting to dive in and start coding, but it’s important to begin with a few introductory comments. And you can try out some code in Photoshop by clicking the Run icon. ExtendScript Toolkit, unlike a plain text-editing program, automatically colors your code so that you can more easily see what you’re doing. On the PC, you may find this utility in C:\Program Files\Adobe\Adobe Utilities. ![]() On the Mac, go to the Finder and press Command-Shift-U to open the Applications:Utilities folder, then open the Adobe Utilities subfolder. STEP 3 Start the ExtendScript Toolkit Utilityīefore you can create a JavaScript file, you need a script-editing program such as ExtendScript Toolkit, included with Photoshop. You can record the deletion of a channel as an action, but an action isn’t smart enough to apply only to alpha channels and repeat the deletion as long as alpha channels exist. You can save a copy of an image without alpha channels, but that requires the extra step of opening the original image if you want to work on it. You can select multiple channels, but you can delete only one channel at a time. No sense in including the alpha channels, so you delete them. Suppose you want to prepare an image for a client. On the right, the Channels palette shows close to a dozen alpha channels, each of which represents a step in the masking process. First we see the original image next we see the masked foreground set against a different background, with wispy hair and translucent flame blended to perfection. Our sample is a real-world masking example from my book Adobe Photoshop CS2 One-on-One. A single complex mask may require the creation of several alpha channels. Writing a JavaScript RoutineĪs you may know, an alpha channel is an extra grayscale plate that lets you save a selection or mask along with an image. Then we’ll install the command into Photoshop and test it on a sample image. This tutorial will walk you through the process of creating a simple JavaScript command that deletes all alpha channels from an image, no matter how many there are. But did you know that you can create your own custom command, one that’s smart enough to perform certain operations under certain conditions, using a few lines of JavaScript code? Scripting is woven into the fabric of the program, providing you unparalleled access to the program’s inner workings.īut why am I telling you this? You’re a creative professional, not a programmer. You may even know that you can apply an action to multiple images at a time with either the Batch or Image Processor command. If you’ve attained a moderate level of experience with Photoshop, you know that you can automate the program by recording a sequence of operations from the Actions palette.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |