Working With Layer Objects - Adobe 65048332 Manual

Scripting guide
Table of Contents

Advertisement

C
3: Scripting Photoshop
HAPTER
'Crop the document with
' angle=45, width=20,height=20
docRef.Crop Array(100,200,400,500),45,20,20
docRef.FlipCanvas 1 ' psHorizontal
'restore ruler units
appRef.Preferences.RulerUnits = startRulerUnits
JS
//save original ruler units, then assign it to inches
startRulerUnits = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.INCHES
//get a reference to the file, and open it
var fileRef = new File(app.path + "/samples/ducky.tif")
var docRef = app.open(fileRef)
//this sample script assumes the ruler units have been set to inches
docRef.resizeImage( 4,4 )
docRef.resizeCanvas( 4,4 )
docRef.trim(TrimType.TOPLEFT, true, false, true, false)
//the crop command uses unit values
//so change the ruler units to pixels
app.preferences.rulerUnits =Units.PIXELS
docRef.crop (new Array(100,200,400,500), 45, 20, 20)
docRef.flipCanvas(Direction.HORIZONTAL)
//restore original preferences
app.preferences.rulerUnits = startRulerUnits

Working with layer objects

The Photoshop object model contains two types of layer objects:
ArtLayer
Photoshop application.
N
OTE
object's type to text layer.
Layer Set
When you create a layer you must specify whether you are creating an
N
: Both the
OTE
LayerSets
LayerSet
have an
add/Add/add()
objects, which can contain image contents and are basically equivalent to Layers in the
: An
object can also contain text if you use the
ArtLayer
objects, which can contain zero or more
and
ArtLayer
LayerSet
, which have an
add/Add/add()
objects using the
Layers
command.
ArtLayer
objects have corresponding collection objects,
command.You can reference, but not add,
collection object, because, unlike other collection objects, it does not
Working with the Photoshop Object Model 36
property to set the
kind
objects.
or a
ArtLayer
Layer Set
ArtLayer
ArtLayer
.
and
ArtLayers
and

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

65048599Photoshop cs5

Table of Contents