-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathSelectionStroke.py
More file actions
60 lines (54 loc) · 1.23 KB
/
Copy pathSelectionStroke.py
File metadata and controls
60 lines (54 loc) · 1.23 KB
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
# Stroke a selection border (macOS).
from appscript import k
from ps_connect import photoshop
ps = photoshop()
ps.display_dialogs.set(k.never)
if len(ps.documents()) < 1:
ps.settings.ruler_units.set(k.pixel_units)
doc = ps.make(
new=k.document,
with_properties={
k.width: 320,
k.height: 240,
k.resolution: 72,
k.mode: k.RGB,
k.initial_fill: k.white,
},
)
doc.make(new=k.art_layer)
else:
doc = ps.current_document()
ps.settings.ruler_units.set(k.pixel_units)
width, height = doc.width(), doc.height()
offset = 10
doc.select(
region=(
(offset, offset),
(width - offset, offset),
(width - offset, height - offset),
(offset, height - offset),
)
)
try:
doc.select_border(width=5)
except Exception:
pass
stroke_color = {
k.class_: k.CMYK_color,
k.cyan: 20,
k.magenta: 90,
k.yellow: 50,
k.black: 50,
}
try:
doc.stroke(
using_color=stroke_color,
width=2,
location=k.outside,
blend_mode=k.vivid_light,
opacity=75,
preserving_transparency=True,
)
print("Stroked selection")
except Exception as exc:
print("stroke note:", exc)