Adobe 23101764 Scripting Guide - Page 76

Layer objects

Page 76 highlights

Scripting Photoshop 3 Layer objects JS: docRef.crop (new Array(10,20,40,50), 45, 20, 20, 72); To flip the canvas horizontally: AS: flip canvas current document direction horizontal VB: docRef.FlipCanvas psHorizontal JS: docRef.flipCanvas(Direction.HORIZONTAL); 3.10 Layer objects Photoshop has 2 types of layers: an art layer that can contain image contents and a layer set that can contain zero or more art layers. Scripts, likewise, have two types of layers: art layer and layer set. Both types of layers have common properties such as "visible." The common attributes are placed in a general "layer" class that both "art layer" and "layer set" inherit from. When you create a layer you must specify whether you are creating an art layer or a layer set. The following examples show how to create an art layer filled with red at the beginning of the current document AS: tell application "Adobe Photoshop CS" make new art layer at beginning of current document ¬ with properties {name:"MyBlendLayer", blend mode:normal} select all current document fill selection of current document with contents ¬ {class:RGB color, red:255, green:0, blue:0} end tell Photoshop CS Scripting Guide 72

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105

Photoshop CS Scripting Guide
72
Scripting Photoshop
Layer objects
3
JS:
docRef.crop (new Array(10,20,40,50), 45, 20, 20, 72);
To
ip the canvas horizontally:
AS:
flip canvas current document direction horizontal
VB:
docRef.FlipCanvas psHorizontal
JS:
docRef.flipCanvas(Direction.HORIZONTAL);
3.10 Layer objects
Photoshop has 2 types of layers: an
art layer
that can contain image contents and a
layer
set
that can contain zero or more art layers. Scripts, likewise, have two types of layers:
art
layer
and
layer set
.
Both types of layers have common properties such as “visible.” The common attributes are
placed in a general “layer” class that both “art layer” and “layer set” inherit from.
When you create a layer you must specify whether you are creating an art layer or a layer set.
The following examples show how to create an art layer
lled with red at the beginning of the
current document
AS:
tell application "Adobe Photoshop CS"
make new art layer at beginning of current document ¬
with properties {name:"MyBlendLayer", blend mode:normal}
select all current document
fill selection of current document with contents ¬
{class:RGB color, red:255, green:0, blue:0}
end tell