C
HAPTER
2: Photoshop Scripting Basics
Photoshop Object Model
12
.
Application and document classes
The
Application
class is the root of the Photoshop object model hierarchy. Scripts must target the
appropriate application in order to run correctly. See
“Targeting and Referencing the Application Object”
on page 22
.
The
Document
class 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. You could also use
the
Document
object to get the active layer, then, save the current document, and copy and paste within
the active document or between different documents. For more information on using document objects,
see
“Creating New Objects in a Script” on page 23
and
“Using the Document object” on page 34
.
Layer classes
Photoshop has two types of layers: an
Art
Layer
that can contain image contents and a
Layer
Set
that
can contain zero or more art layers.
An
Art
Layer
is a layer class within a document that allows you to work on one element of an image
without disturbing the others. Images are typically composed of multiple layers, defined by a
Layer
Set
.
You can change the composition of an image by changing the order and attributes of the layers that
comprise it.
A
Text
Item
is a particular type of art layer that allows you to add type to an image. In Photoshop, a
Text Item
item is implemented as a property of the art layer. For more information on text items, see
“Using the Text Item object” on page 41
.
Channel
Selection
History
State
Photoshop containment hierarchy
Path Item
Path
Info
Document
Notifier
Preferences
Sub Path
Item
(showing key classes only)
Item
Count
Sampler
Color
ment
Measure-
Point
Document
Application
Scale
Text Item
(Object)
Art Layer
Layer
Comp
Layer Set
Art Layer
Layer Set