Adobe 65014293 Scripting Guide - Page 53
Comparing colors, Getting a Web-safe color, Working with Filters
UPC - 883919153544
View all Adobe 65014293 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 53 highlights
CHAPTER 3: Scripting Photoshop Working with Filters 53 Look up the following in the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser: ➤ model and cmyk as properties of the SolidColor object JS This example uses the foregroundColor property of the Application object to get the original color to be converted. The cmyk property of the SolidColor object that foregroundColor refers to provides a way to access the cmyk equivalent of the rgb color. var someColor = foregroundColor.cmyk Look up the following in the Adobe Photoshop CS4 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer: ➤ cmyk as a property of the SolidColor object ➤ foregroundColor as a property of the Application object Comparing colors Using the equal colors (IsEqual/isEqual) command, you can compare colors. The following statements return true if the foreground color is visually equal to background color. ➤ AS: if equal colors foreground color with background color then ➤ VBS: If (appRef.ForegroundColor.IsEqual(appRef.BackgroundColor)) Then ➤ JS: if (app.foregroundColor.isEqual(backgroundColor)) Getting a Web-safe color AS VBS JS To convert a color to a web safe color use the web safe color command on AppleScript and the NearestWebColor/nearestWebColor property of the SolidColor object for VBScript and JavaScript. set myWebSafeColor to web safe color for foreground color Dim myWebSafeColor Set myWebSafeColor = appRef.ForegroundColor.NearestWebColor var webSafeColor = new RGBColor() webSafeColor = app.foregroundColor.nearestWebColor Working with Filters To apply a filter in AppleScript, you use the filter command with an option from the class filter options. In VBScript and JavaScript, you use a specific filter method. For example, to apply a Gaussian blur filter, you use the ApplyGaussianBlur/applyGaussianBlur() method. All filter methods belong to the ArtLayer object. NOTE: Please refer to Photoshop Help for information about the effects produced by individual filter types. The following examples apply the Gaussian blur filter to the active layer.