Adobe 23101764 Scripting Guide - Page 75
Document manipulation
UPC - 718659340025
View all Adobe 23101764 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 75 highlights
Scripting Photoshop 3 Document object 3.9.3 Document manipulation The Document object is used to make modifications to the document image. By using the Document object you can crop, rotate or flip the canvas, resize the image or canvas, and trim the Image. Because unit values are passed in when resizing an image, it is recommended that you first set your ruler units prior to resizing. See section 3.6.3, "Changing ruler and type units" on page 61 for more information. The examples in this section assume that the ruler units have been set to inches. To resize the image so that it is four inches wide by four inches high, use the document's resize (Resize/resize) command. AS: resize image current document width 4 height 4 VB: docRef.ResizeImage 4,4 JS: docRef.resizeImage( 4,4 ); Resizing the canvas is done similarly. AS: resize canvas current document width 4 height 4 VB: docRef.ResizeCanvas 4,4 JS: docRef.resizeCanvas( 4,4 ); To trim the excess space from a document, use the trim (Trim/trim) command. The example below will trim the top and bottom of the document. AS: trim current document basing trim on top left pixel ¬ with top trim and bottom trim without left trim and right trim VB: docRef.Trim Type:=psTopLeftPixel, Top:=True, Left:=False, _ Bottom:=True, Right:=False JS: docRef.trim(TrimType.TOPLEFT, true, false, true, false); NOTE: The crop command uses unit values. The examples below assume that the ruler unit is set to pixels. AS: crop current document bounds {10, 20, 40, 50} angle 45 ¬ resolution 72 width 20 height 20 VB: docRef.Crop Array(10,20,40,50), Angle:=45, Width:=20, _ Height:=20, Resolution:=72 Photoshop CS Scripting Guide 71