@bubblydoo/photoshop-mcp 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7049 -0
- package/dist/index.js.map +1 -0
- package/dist-readmes/README.md +383 -0
- package/dist-runtime/runtime-code.cjs +17124 -0
- package/dist-runtime/runtime-code.d.cts +9 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/index.d.ts +16 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/all-types.d.ts +65 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Actions.d.ts +230 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Channel.d.ts +120 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/ColorSampler.d.ts +105 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Constants.d.ts +1648 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/CoreModules.d.ts +922 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/CountItem.d.ts +86 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Document.d.ts +931 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Guide.d.ts +105 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/HistoryState.d.ts +74 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/ImagingModule.d.ts +559 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Layer.d.ts +1073 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/LayerComp.d.ts +219 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Objects.d.ts +7 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/PathItem.d.ts +243 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/PathPoint.d.ts +78 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Photoshop.d.ts +317 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Selection.d.ts +557 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/SubPathItem.d.ts +69 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/TextItem.d.ts +213 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Channels.d.ts +81 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/ColorSamplers.d.ts +97 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/CountItems.d.ts +130 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Documents.d.ts +95 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Guides.d.ts +76 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/HistoryStates.d.ts +56 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/LayerComps.d.ts +92 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Layers.d.ts +68 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/PathItems.d.ts +65 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/PathPoints.d.ts +50 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/SubPathItems.d.ts +50 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/TextFonts.d.ts +43 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/Colors.d.ts +225 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/ConversionOptions.d.ts +213 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/ImagingBounds.d.ts +53 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/PathPointInfo.d.ts +84 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/SaveOptions.d.ts +376 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/SolidColor.d.ts +118 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/SubPathInfo.d.ts +47 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/TextFont.d.ts +49 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/Tool.d.ts +23 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/Preferences.d.ts +121 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesBase.d.ts +9 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesCursors.d.ts +37 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesFileHandling.d.ts +58 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesGeneral.d.ts +77 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesGuidesGridsAndSlices.d.ts +51 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesHistory.d.ts +69 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesInterface.d.ts +46 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesPerformance.d.ts +42 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesTools.d.ts +44 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesTransparencyAndGamut.d.ts +38 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesType.d.ts +44 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesUnitsAndRulers.d.ts +44 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/text/CharacterStyle.d.ts +254 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/text/ParagraphStyle.d.ts +114 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/text/TextWarpStyle.d.ts +48 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/ApplyImageTypes.d.ts +107 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/CalculationsTypes.d.ts +119 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/DocumentTypes.d.ts +80 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/LayerCompTypes.d.ts +91 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/LayerTypes.d.ts +153 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/SharedTypes.d.ts +6 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/TextTypes.d.ts +218 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/util/colorTypes.d.ts +61 -0
- package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/util/unit.d.ts +45 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/index.d.ts +21 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/all-types.d.ts +3 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/dialog.d.ts +26 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/entrypoints.d.ts +385 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/host.d.ts +28 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/os.d.ts +56 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/other.d.ts +7 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/shell.d.ts +54 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/storage.d.ts +1216 -0
- package/dist-schemas/@adobe-uxp-types/uxp/src/internal/versions.d.ts +18 -0
- package/dist-schemas/@bubblydoo/uxp-toolkit/dist/commands-library/index.d.ts +109 -0
- package/dist-schemas/@bubblydoo/uxp-toolkit/dist/index.d.ts +153 -0
- package/dist-schemas/@bubblydoo/uxp-toolkit/dist/psLayerRef-BJKcxKbm.d.ts +66 -0
- package/package.json +51 -0
|
@@ -0,0 +1,931 @@
|
|
|
1
|
+
import type { Channel } from './Channel';
|
|
2
|
+
import type { Channels } from './collections/Channels';
|
|
3
|
+
import type { ColorSamplers } from './collections/ColorSamplers';
|
|
4
|
+
import type { CountItems } from './collections/CountItems';
|
|
5
|
+
import type { Guides } from './collections/Guides';
|
|
6
|
+
import type { HistoryStates } from './collections/HistoryStates';
|
|
7
|
+
import type { LayerComps } from './collections/LayerComps';
|
|
8
|
+
import type { Layers } from './collections/Layers';
|
|
9
|
+
import type { PathItems } from './collections/PathItems';
|
|
10
|
+
import type * as Constants from './Constants';
|
|
11
|
+
import type { ExecutionContext } from './CoreModules';
|
|
12
|
+
import type { HistoryState } from './HistoryState';
|
|
13
|
+
import type { Layer } from './Layer';
|
|
14
|
+
import type { BMPSaveOptions, GIFSaveOptions, JPEGSaveOptions, PhotoshopSaveOptions, PNGSaveOptions } from './Objects';
|
|
15
|
+
import type { NoColor } from './objects/Colors';
|
|
16
|
+
import type { BitmapConversionOptions, IndexedConversionOptions } from './objects/ConversionOptions';
|
|
17
|
+
import type { ImagingBounds } from './objects/ImagingBounds';
|
|
18
|
+
import type { SolidColor } from './objects/SolidColor';
|
|
19
|
+
import type { Selection } from './Selection';
|
|
20
|
+
import type { CalculationsOptions } from './types/CalculationsTypes';
|
|
21
|
+
import type { GroupLayerCreateOptions, PixelLayerCreateOptions, TextLayerCreateOptions } from './types/LayerTypes';
|
|
22
|
+
/**
|
|
23
|
+
* Execution Context with the Document injected for modal execution within Document.suspendHistory
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
export interface SuspendHistoryContext extends ExecutionContext {
|
|
27
|
+
document: Document;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Represents a single Photoshop document that is currently open.
|
|
31
|
+
*
|
|
32
|
+
* You can access instances of documents using one of these methods:
|
|
33
|
+
*
|
|
34
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/}
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```js
|
|
38
|
+
* const {app, constants} = require('photoshop');
|
|
39
|
+
* // The currently active document from the Photoshop object
|
|
40
|
+
* const currentDocument = app.activeDocument;
|
|
41
|
+
* // Choose one of the open documents from the Photoshop object
|
|
42
|
+
* const secondDocument = app.documents[1];
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```js
|
|
47
|
+
* // You can also create an instance of a document via a UXP File entry
|
|
48
|
+
* let fileEntry = require('uxp').storage.localFileSystem.getFileForOpening();
|
|
49
|
+
* const newDocument = await app.open('/project.psd');
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export class Document {
|
|
53
|
+
/**
|
|
54
|
+
* The class name of the referenced object: *"Document"*.
|
|
55
|
+
*
|
|
56
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#typename}
|
|
57
|
+
* @minVersion 23.0
|
|
58
|
+
*/
|
|
59
|
+
get typename(): 'Document';
|
|
60
|
+
/**
|
|
61
|
+
* The internal ID of this document will remain valid as long as this document is open.
|
|
62
|
+
* It can be used for batchPlay calls to refer to this document.
|
|
63
|
+
*
|
|
64
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#id}
|
|
65
|
+
* @minVersion 22.5
|
|
66
|
+
*/
|
|
67
|
+
get id(): number;
|
|
68
|
+
/**
|
|
69
|
+
* True if the document has been saved since the last change.
|
|
70
|
+
*
|
|
71
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#saved}
|
|
72
|
+
* @minVersion 23.0
|
|
73
|
+
*/
|
|
74
|
+
get saved(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The selected layers in the document.
|
|
77
|
+
*
|
|
78
|
+
* Updates: [(26.9)](https://developer.adobe.com/photoshop/uxp/2022/ps_reference/changelog/#photoshop-269-july-2025)
|
|
79
|
+
*
|
|
80
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#activelayers}
|
|
81
|
+
* @minVersion 22.5
|
|
82
|
+
*/
|
|
83
|
+
get activeLayers(): Layers;
|
|
84
|
+
/**
|
|
85
|
+
* The artboards in the document.
|
|
86
|
+
*
|
|
87
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#artboards}
|
|
88
|
+
* @minVersion 22.5
|
|
89
|
+
*/
|
|
90
|
+
get artboards(): Layers;
|
|
91
|
+
/**
|
|
92
|
+
* The name of the document.
|
|
93
|
+
*
|
|
94
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#name}
|
|
95
|
+
* @minVersion 23.0
|
|
96
|
+
*/
|
|
97
|
+
get name(): string;
|
|
98
|
+
/**
|
|
99
|
+
* A histogram containing the number of pixels at each color
|
|
100
|
+
* intensity level for the component channel. The array contains 256
|
|
101
|
+
* members.
|
|
102
|
+
*
|
|
103
|
+
* Valid only when mode = `DocumentMode.{RGB,CMYK,INDEXEDCOLOR}`
|
|
104
|
+
*
|
|
105
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#histogram}
|
|
106
|
+
* @minVersion 23.0
|
|
107
|
+
*/
|
|
108
|
+
get histogram(): number[];
|
|
109
|
+
/**
|
|
110
|
+
* The state of Quick Mask mode. If true, the app is in Quick Mask mode.
|
|
111
|
+
*
|
|
112
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#quickmaskmode}
|
|
113
|
+
* @minVersion 23.0
|
|
114
|
+
*/
|
|
115
|
+
get quickMaskMode(): boolean;
|
|
116
|
+
set quickMaskMode(qmMode: boolean);
|
|
117
|
+
/**
|
|
118
|
+
* The collection of Guides present in the document.
|
|
119
|
+
*
|
|
120
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#guides}
|
|
121
|
+
* @minVersion 23.0
|
|
122
|
+
*/
|
|
123
|
+
get guides(): Guides;
|
|
124
|
+
/**
|
|
125
|
+
* The collection of CountItems present in the document.
|
|
126
|
+
*
|
|
127
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#countitems}
|
|
128
|
+
* @minVersion 24.1
|
|
129
|
+
*/
|
|
130
|
+
get countItems(): CountItems;
|
|
131
|
+
/**
|
|
132
|
+
* The collection of ColorSamplers present in the document.
|
|
133
|
+
*
|
|
134
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#colorsamplers}
|
|
135
|
+
* @minVersion 24.0
|
|
136
|
+
*/
|
|
137
|
+
get colorSamplers(): ColorSamplers;
|
|
138
|
+
/**
|
|
139
|
+
* The color mode. To change it, please use Document.changeMode.
|
|
140
|
+
*
|
|
141
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#mode}
|
|
142
|
+
* @minVersion 23.0
|
|
143
|
+
*/
|
|
144
|
+
get mode(): Constants.DocumentMode;
|
|
145
|
+
/**
|
|
146
|
+
* The bits per color channel.
|
|
147
|
+
*
|
|
148
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#bitsperchannel}
|
|
149
|
+
* @minVersion 23.0
|
|
150
|
+
*/
|
|
151
|
+
get bitsPerChannel(): Constants.BitsPerChannelType;
|
|
152
|
+
set bitsPerChannel(bitDepth: Constants.BitsPerChannelType);
|
|
153
|
+
/**
|
|
154
|
+
* Check whether this a [Photoshop cloud document](https://helpx.adobe.com/photoshop/using/cloud-documents-faq.html).
|
|
155
|
+
*
|
|
156
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#clouddocument}
|
|
157
|
+
* @minVersion 23.0
|
|
158
|
+
*/
|
|
159
|
+
get cloudDocument(): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Local directory for this cloud document.
|
|
162
|
+
*
|
|
163
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#cloudworkareadirectory}
|
|
164
|
+
* @minVersion 23.0
|
|
165
|
+
*/
|
|
166
|
+
get cloudWorkAreaDirectory(): string;
|
|
167
|
+
/**
|
|
168
|
+
* The layers in the document at the top level of the layer/group hierarchy.
|
|
169
|
+
*
|
|
170
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#layers}
|
|
171
|
+
* @minVersion 22.5
|
|
172
|
+
*/
|
|
173
|
+
get layers(): Layers;
|
|
174
|
+
/**
|
|
175
|
+
* The layer comps present in the document.
|
|
176
|
+
*
|
|
177
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#layercomps}
|
|
178
|
+
* @minVersion 24.0
|
|
179
|
+
*/
|
|
180
|
+
get layerComps(): LayerComps;
|
|
181
|
+
/**
|
|
182
|
+
* Background layer, if it exists.
|
|
183
|
+
*
|
|
184
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#backgroundlayer}
|
|
185
|
+
* @minVersion 22.5
|
|
186
|
+
*/
|
|
187
|
+
get backgroundLayer(): Layer | null;
|
|
188
|
+
/**
|
|
189
|
+
* Full file system path to this document, or the identifier if it is a cloud document.
|
|
190
|
+
*
|
|
191
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#path}
|
|
192
|
+
* @minVersion 22.5
|
|
193
|
+
*/
|
|
194
|
+
get path(): string;
|
|
195
|
+
/**
|
|
196
|
+
* The collection of paths in this document, as shown in the
|
|
197
|
+
* Paths panel.
|
|
198
|
+
*
|
|
199
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#pathitems}
|
|
200
|
+
* @minVersion 23.3
|
|
201
|
+
*/
|
|
202
|
+
get pathItems(): PathItems;
|
|
203
|
+
/**
|
|
204
|
+
* History states of the document.
|
|
205
|
+
*
|
|
206
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#historystates}
|
|
207
|
+
* @minVersion 22.5
|
|
208
|
+
*/
|
|
209
|
+
get historyStates(): HistoryStates;
|
|
210
|
+
/**
|
|
211
|
+
* Currently active history state of the document.
|
|
212
|
+
*
|
|
213
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#activehistorystate}
|
|
214
|
+
* @minVersion 22.5
|
|
215
|
+
*/
|
|
216
|
+
get activeHistoryState(): HistoryState;
|
|
217
|
+
/**
|
|
218
|
+
* Selects the given history state to be the active one.
|
|
219
|
+
*
|
|
220
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#activehistorystate}
|
|
221
|
+
* @minVersion 22.5
|
|
222
|
+
*/
|
|
223
|
+
set activeHistoryState(historyState: HistoryState);
|
|
224
|
+
/**
|
|
225
|
+
* The history state that history brush tool will use as its source.
|
|
226
|
+
*
|
|
227
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#activehistorybrushsource}
|
|
228
|
+
* @minVersion 22.5
|
|
229
|
+
*/
|
|
230
|
+
get activeHistoryBrushSource(): HistoryState;
|
|
231
|
+
set activeHistoryBrushSource(historyState: HistoryState);
|
|
232
|
+
/**
|
|
233
|
+
* Document title.
|
|
234
|
+
*
|
|
235
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#title}
|
|
236
|
+
* @minVersion 22.5
|
|
237
|
+
*/
|
|
238
|
+
get title(): string;
|
|
239
|
+
/**
|
|
240
|
+
* Document's resolution (in pixels per inch).
|
|
241
|
+
*
|
|
242
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#resolution}
|
|
243
|
+
* @minVersion 22.5
|
|
244
|
+
*/
|
|
245
|
+
get resolution(): number;
|
|
246
|
+
/**
|
|
247
|
+
* Document's width in pixels.
|
|
248
|
+
*
|
|
249
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#width}
|
|
250
|
+
* @minVersion 22.5
|
|
251
|
+
*/
|
|
252
|
+
get width(): number;
|
|
253
|
+
/**
|
|
254
|
+
* Document's height in pixels.
|
|
255
|
+
*
|
|
256
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#height}
|
|
257
|
+
* @minVersion 22.5
|
|
258
|
+
*/
|
|
259
|
+
get height(): number;
|
|
260
|
+
/**
|
|
261
|
+
* The (custom) pixel aspect ratio to use.
|
|
262
|
+
*
|
|
263
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#pixelaspectratio}
|
|
264
|
+
* @minVersion 22.5
|
|
265
|
+
*/
|
|
266
|
+
get pixelAspectRatio(): number;
|
|
267
|
+
set pixelAspectRatio(newValue: number);
|
|
268
|
+
/**
|
|
269
|
+
* Name of the color profile.
|
|
270
|
+
*
|
|
271
|
+
* Valid only when colorProfileType is `CUSTOM` or `WORKING`, returns "None" otherwise.
|
|
272
|
+
*
|
|
273
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#colorprofilename}
|
|
274
|
+
* @minVersion 23.0
|
|
275
|
+
*/
|
|
276
|
+
get colorProfileName(): string;
|
|
277
|
+
set colorProfileName(profile: string);
|
|
278
|
+
/**
|
|
279
|
+
* Whether the document uses the working color profile, a custom profile, or no profile.
|
|
280
|
+
*
|
|
281
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#colorprofiletype}
|
|
282
|
+
* @minVersion 23.0
|
|
283
|
+
*/
|
|
284
|
+
get colorProfileType(): Constants.ColorProfileType;
|
|
285
|
+
set colorProfileType(type: Constants.ColorProfileType);
|
|
286
|
+
/**
|
|
287
|
+
* The object containing the document's currently active selection.
|
|
288
|
+
*
|
|
289
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#selection}
|
|
290
|
+
* @minVersion 25.0
|
|
291
|
+
*/
|
|
292
|
+
readonly selection: Selection;
|
|
293
|
+
/**
|
|
294
|
+
* @ignore
|
|
295
|
+
*/
|
|
296
|
+
constructor(id: number);
|
|
297
|
+
/**
|
|
298
|
+
* Closes the document, showing a prompt to save
|
|
299
|
+
* unsaved changes if specified.
|
|
300
|
+
*
|
|
301
|
+
* @param saveDialogOptions By default, prompts a save dialog
|
|
302
|
+
* if there are unsaved changes.
|
|
303
|
+
*
|
|
304
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#close}
|
|
305
|
+
*
|
|
306
|
+
* @async
|
|
307
|
+
* @minVersion 22.5
|
|
308
|
+
*/
|
|
309
|
+
close(saveDialogOptions?: Constants.SaveOptions): Promise<void>;
|
|
310
|
+
/**
|
|
311
|
+
* Close the document, discarding all unsaved changes.
|
|
312
|
+
*
|
|
313
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#closewithoutsaving}
|
|
314
|
+
* @minVersion 22.5
|
|
315
|
+
*/
|
|
316
|
+
closeWithoutSaving(): void;
|
|
317
|
+
/**
|
|
318
|
+
* Crops the document to the given bounds.
|
|
319
|
+
*
|
|
320
|
+
* @param bounds The crop area bounds.
|
|
321
|
+
* @param angle Angle to rotate the crop area (default: 0).
|
|
322
|
+
* @param width Width of the crop area (default: 0).
|
|
323
|
+
* @param height Height of the crop area (default: 0).
|
|
324
|
+
*
|
|
325
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#crop}
|
|
326
|
+
*
|
|
327
|
+
* @async
|
|
328
|
+
* @minVersion 23.0
|
|
329
|
+
*/
|
|
330
|
+
crop(bounds: ImagingBounds, angle?: number, width?: number, height?: number): Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* Flatten all layers in the document. The remaining layer will become Background.
|
|
333
|
+
*
|
|
334
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#flatten}
|
|
335
|
+
*
|
|
336
|
+
* @async
|
|
337
|
+
* @minVersion 22.5
|
|
338
|
+
*/
|
|
339
|
+
flatten(): Promise<void>;
|
|
340
|
+
/**
|
|
341
|
+
* Creates a duplicate of the document, making the duplicate active.
|
|
342
|
+
*
|
|
343
|
+
* The optional parameter `name` provides the name for the duplicated document.
|
|
344
|
+
*
|
|
345
|
+
* The optional parameter `mergeLayersOnly` indicates whether to only duplicate merged layers.
|
|
346
|
+
*
|
|
347
|
+
* @param name Name for the duplicated document.
|
|
348
|
+
* @param mergeLayersOnly Whether to only duplicate merged layers.
|
|
349
|
+
*
|
|
350
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#duplicate}
|
|
351
|
+
*
|
|
352
|
+
* @minVersion 23.0
|
|
353
|
+
*/
|
|
354
|
+
duplicate(name?: string, mergeLayersOnly?: boolean): Promise<Document>;
|
|
355
|
+
/**
|
|
356
|
+
* Merges all visible layers in the document into a single layer.
|
|
357
|
+
*
|
|
358
|
+
* In contrast to flatten, `mergeVisibleLayers` will not convert the remaining layer
|
|
359
|
+
* to Background if no Background already exists. If not Background, then the name of the
|
|
360
|
+
* merged layer will be either that of the top of the selected layers or the top layer.
|
|
361
|
+
*
|
|
362
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#mergevisiblelayers}
|
|
363
|
+
*
|
|
364
|
+
* @async
|
|
365
|
+
* @minVersion 23.0
|
|
366
|
+
*/
|
|
367
|
+
mergeVisibleLayers(): Promise<void>;
|
|
368
|
+
/**
|
|
369
|
+
* Splits the document channels into separate, single-channel
|
|
370
|
+
* documents.
|
|
371
|
+
*
|
|
372
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#splitchannels}
|
|
373
|
+
*
|
|
374
|
+
* @async
|
|
375
|
+
* @minVersion 23.0
|
|
376
|
+
*/
|
|
377
|
+
splitChannels(): Promise<Document[]>;
|
|
378
|
+
/**
|
|
379
|
+
* Expands the document to show clipped sections.
|
|
380
|
+
*
|
|
381
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#revealall}
|
|
382
|
+
*
|
|
383
|
+
* @async
|
|
384
|
+
* @minVersion 23.0
|
|
385
|
+
*/
|
|
386
|
+
revealAll(): Promise<void>;
|
|
387
|
+
/**
|
|
388
|
+
* Converts all layers to pixel layers.
|
|
389
|
+
*
|
|
390
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#rasterizealllayers}
|
|
391
|
+
*
|
|
392
|
+
* @async
|
|
393
|
+
* @minVersion 23.0
|
|
394
|
+
*/
|
|
395
|
+
rasterizeAllLayers(): Promise<void>;
|
|
396
|
+
/**
|
|
397
|
+
* Changes the color mode of the document.
|
|
398
|
+
*
|
|
399
|
+
* @param mode The color mode to change to.
|
|
400
|
+
* @param options Optional conversion options.
|
|
401
|
+
*
|
|
402
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#changemode}
|
|
403
|
+
*
|
|
404
|
+
* @async
|
|
405
|
+
* @minVersion 23.0
|
|
406
|
+
*/
|
|
407
|
+
changeMode(mode: Constants.ChangeMode, options?: BitmapConversionOptions | IndexedConversionOptions): Promise<void>;
|
|
408
|
+
/**
|
|
409
|
+
* Changes the color profile.
|
|
410
|
+
*
|
|
411
|
+
* `destinationProfile` must be either a string that names the color mode,
|
|
412
|
+
* or one of these below, meaning of the working color spaces or Lab color.
|
|
413
|
+
*
|
|
414
|
+
* `"Working RGB", "Working CMYK", "Working Gray", "Lab Color"`
|
|
415
|
+
*
|
|
416
|
+
* @param destinationProfile The profile name or working space.
|
|
417
|
+
* @param intent The rendering intent.
|
|
418
|
+
* @param blackPointCompensation Whether to use black point compensation.
|
|
419
|
+
* @param dither Whether to use dithering.
|
|
420
|
+
*
|
|
421
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#convertprofile}
|
|
422
|
+
*
|
|
423
|
+
* @async
|
|
424
|
+
* @minVersion 23.0
|
|
425
|
+
*/
|
|
426
|
+
convertProfile(
|
|
427
|
+
destinationProfile: string,
|
|
428
|
+
intent: Constants.Intent,
|
|
429
|
+
blackPointCompensation?: boolean,
|
|
430
|
+
dither?: boolean,
|
|
431
|
+
): Promise<void>;
|
|
432
|
+
/**
|
|
433
|
+
* Applies trapping to a CMYK document.
|
|
434
|
+
*
|
|
435
|
+
* Valid only when Document.mode is `Constants.DocumentMode.CMYK`
|
|
436
|
+
*
|
|
437
|
+
* @param width The trap width.
|
|
438
|
+
*
|
|
439
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#trap}
|
|
440
|
+
*
|
|
441
|
+
* @async
|
|
442
|
+
* @minVersion 23.0
|
|
443
|
+
*/
|
|
444
|
+
trap(width: number): Promise<void>;
|
|
445
|
+
/**
|
|
446
|
+
* Changes the size of the document, but does not scale the image.
|
|
447
|
+
* To scale the image size, see resizeImage.
|
|
448
|
+
*
|
|
449
|
+
* @param width Numeric value of new width in pixels.
|
|
450
|
+
* @param height Numeric value of new height in pixels.
|
|
451
|
+
* @param anchor Anchor point for resizing, by default will resize an equal amount on all sides.
|
|
452
|
+
*
|
|
453
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#resizecanvas}
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```js
|
|
457
|
+
* // grow the canvas by 400px
|
|
458
|
+
* const {width, height} = await app.activeDocument;
|
|
459
|
+
* await document.resizeCanvas(width + 400, height + 400);
|
|
460
|
+
* ```
|
|
461
|
+
*
|
|
462
|
+
* @async
|
|
463
|
+
* @minVersion 23.0
|
|
464
|
+
*/
|
|
465
|
+
resizeCanvas(width: number, height: number, anchor?: Constants.AnchorPosition): Promise<void>;
|
|
466
|
+
/**
|
|
467
|
+
* Changes the size of the image by scaling the dimensions to meet the targeted number of pixels.
|
|
468
|
+
*
|
|
469
|
+
* @param width Numeric value of new width in pixels.
|
|
470
|
+
* @param height Numeric value of new height in pixels.
|
|
471
|
+
* @param resolution Image resolution in pixels per inch (ppi).
|
|
472
|
+
* @param resampleMethod Method used during image interpolation.
|
|
473
|
+
* @param amount Numeric value that controls the amount of noise value when using preserve details 0..100.
|
|
474
|
+
*
|
|
475
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#resizeimage}
|
|
476
|
+
*
|
|
477
|
+
* @example
|
|
478
|
+
* ```js
|
|
479
|
+
* await document.resizeImage(800, 600)
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* @async
|
|
483
|
+
* @minVersion 23.0
|
|
484
|
+
*/
|
|
485
|
+
resizeImage(
|
|
486
|
+
width?: number,
|
|
487
|
+
height?: number,
|
|
488
|
+
resolution?: number,
|
|
489
|
+
resampleMethod?: Constants.ResampleMethod,
|
|
490
|
+
amount?: number,
|
|
491
|
+
): Promise<void>;
|
|
492
|
+
/**
|
|
493
|
+
* Trims the area around the image according to the type of pixels given.
|
|
494
|
+
* All sides of the image are targeted by default.
|
|
495
|
+
* Optionally, the sides may be individually specified for exclusion.
|
|
496
|
+
*
|
|
497
|
+
* @param trimType Defaults to the top left pixel color.
|
|
498
|
+
* @param top Trim the top side (default: true).
|
|
499
|
+
* @param left Trim the left side (default: true).
|
|
500
|
+
* @param bottom Trim the bottom side (default: true).
|
|
501
|
+
* @param right Trim the right side (default: true).
|
|
502
|
+
*
|
|
503
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#trim}
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* ```js
|
|
507
|
+
* // trim transparent pixels from only the bottom of the image
|
|
508
|
+
* app.activeDocument.trim(constants.TrimType.TRANSPARENT, false, false, true, false);
|
|
509
|
+
* ```
|
|
510
|
+
*
|
|
511
|
+
* @async
|
|
512
|
+
* @minVersion 23.0
|
|
513
|
+
*/
|
|
514
|
+
trim(trimType: Constants.TrimType, top?: boolean, left?: boolean, bottom?: boolean, right?: boolean): Promise<void>;
|
|
515
|
+
/**
|
|
516
|
+
* Rotates the image clockwise in given angle, expanding canvas if necessary. (Previously rotateCanvas)
|
|
517
|
+
*
|
|
518
|
+
* @param angles The angle in degrees to rotate.
|
|
519
|
+
*
|
|
520
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#rotate}
|
|
521
|
+
*
|
|
522
|
+
* @async
|
|
523
|
+
* @minVersion 23.0
|
|
524
|
+
*/
|
|
525
|
+
rotate(angles: number): Promise<void>;
|
|
526
|
+
/**
|
|
527
|
+
* Pastes the contents of the clipboard into the document. If the optional argument is
|
|
528
|
+
* set to true and a selection is active, the contents are pasted into the selection.
|
|
529
|
+
*
|
|
530
|
+
* @param intoSelection Whether to use an active selection as the target for the paste.
|
|
531
|
+
*
|
|
532
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#paste}
|
|
533
|
+
*
|
|
534
|
+
* @async
|
|
535
|
+
* @minVersion 23.0
|
|
536
|
+
*/
|
|
537
|
+
paste(intoSelection?: boolean): Promise<Layer | null>;
|
|
538
|
+
/**
|
|
539
|
+
* Performs a save of the document. The user will be presented with
|
|
540
|
+
* a Save dialog if the file has yet to be saved on disk.
|
|
541
|
+
*
|
|
542
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#save}
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* ```js
|
|
546
|
+
* // To save a document in the current location
|
|
547
|
+
* document.save()
|
|
548
|
+
* // Shows the save dialog
|
|
549
|
+
* unsavedDocument.save()
|
|
550
|
+
* ```
|
|
551
|
+
*
|
|
552
|
+
* @async
|
|
553
|
+
* @minVersion 23.0
|
|
554
|
+
*/
|
|
555
|
+
save(): Promise<void>;
|
|
556
|
+
/**
|
|
557
|
+
* Save the document to a desired file type.
|
|
558
|
+
*
|
|
559
|
+
* For operations that require a UXP File token, use the
|
|
560
|
+
* [UXP storage APIs](https://www.adobe.com/go/ps-api-uxp-filesystemprovider) to generate one.
|
|
561
|
+
*
|
|
562
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#saveas}
|
|
563
|
+
*
|
|
564
|
+
* @example
|
|
565
|
+
* ```js
|
|
566
|
+
* let entry = await require('uxp').storage.localFileSystem.getFileForSaving("target.psd");
|
|
567
|
+
* document.saveAs.psd(entry);
|
|
568
|
+
* // Save as a Copy (High JPG quality)
|
|
569
|
+
* document.saveAs.jpg(entryJpg, {quality: 12}, true);
|
|
570
|
+
* // Save a PSB, with some options:
|
|
571
|
+
* document.saveAs.psb(entryPsb, {embedColorProfile: true});
|
|
572
|
+
* ```
|
|
573
|
+
*
|
|
574
|
+
* @minVersion 23.0
|
|
575
|
+
*/
|
|
576
|
+
saveAs: {
|
|
577
|
+
/**
|
|
578
|
+
* Save the document as a PSD file.
|
|
579
|
+
* @param entry UXP File token generated from the UXP Storage APIs.
|
|
580
|
+
* @param saveOptions PSD specific save options. See SaveOptions/PhotoshopSaveOptions.
|
|
581
|
+
* @param asCopy Whether to save as a copy.
|
|
582
|
+
* @minVersion 23.0
|
|
583
|
+
*/
|
|
584
|
+
psd: (entry: File, saveOptions?: PhotoshopSaveOptions, asCopy?: boolean) => Promise<void>;
|
|
585
|
+
/**
|
|
586
|
+
* Save the document as a PSB file.
|
|
587
|
+
* @param entry UXP File token generated from the UXP Storage APIs.
|
|
588
|
+
* @param saveOptions PSD/PSB specific save options. See SaveOptions/PhotoshopSaveOptions.
|
|
589
|
+
* @param asCopy Whether to save as a copy.
|
|
590
|
+
* @minVersion 23.0
|
|
591
|
+
*/
|
|
592
|
+
psb: (entry: File, saveOptions?: PhotoshopSaveOptions, asCopy?: boolean) => Promise<void>;
|
|
593
|
+
/**
|
|
594
|
+
* @TODO reenable when we get the green-light to script PSDC
|
|
595
|
+
* Save the document into Cloud Documents (PSDC).
|
|
596
|
+
* @param path String title or path (separated by slash '/') location to save to.
|
|
597
|
+
* @param saveOptions PSD/PSB specific save options. See SaveOptions/PhotoshopSaveOptions.
|
|
598
|
+
* @minVersion ?
|
|
599
|
+
*/
|
|
600
|
+
/**
|
|
601
|
+
* Save the document as a JPG file.
|
|
602
|
+
* @param entry UXP File token generated from the UXP Storage APIs.
|
|
603
|
+
* @param saveOptions JPEG specific save options. See SaveOptions/JPEGSaveOptions.
|
|
604
|
+
* @param asCopy Whether to save as a copy.
|
|
605
|
+
* @minVersion 23.0
|
|
606
|
+
*/
|
|
607
|
+
jpg: (entry: File, saveOptions?: JPEGSaveOptions, asCopy?: boolean) => Promise<void>;
|
|
608
|
+
/**
|
|
609
|
+
* Save the document as a GIF file.
|
|
610
|
+
* @param entry UXP File token generated from the UXP Storage APIs.
|
|
611
|
+
* @param saveOptions GIF specific save options. See SaveOptions/GIFSaveOptions.
|
|
612
|
+
* @param asCopy Whether to save as a copy.
|
|
613
|
+
* @minVersion 23.0
|
|
614
|
+
*/
|
|
615
|
+
gif: (entry: File, saveOptions?: GIFSaveOptions, asCopy?: boolean) => Promise<void>;
|
|
616
|
+
/**
|
|
617
|
+
* Save the document as a PNG file.
|
|
618
|
+
* @param entry UXP File token generated from the UXP Storage APIs.
|
|
619
|
+
* @param saveOptions PNG specific save options. See SaveOptions/PNGSaveOptions.
|
|
620
|
+
* @param asCopy Whether to save as a copy.
|
|
621
|
+
* @minVersion 23.0
|
|
622
|
+
*/
|
|
623
|
+
png: (entry: File, saveOptions?: PNGSaveOptions, asCopy?: boolean) => Promise<void>;
|
|
624
|
+
/**
|
|
625
|
+
* Save the document as a BMP file.
|
|
626
|
+
* @param entry UXP File token generated from the UXP Storage APIs.
|
|
627
|
+
* @param saveOptions JPEG specific save options. See SaveOptions/BMPSaveOptions.
|
|
628
|
+
* @param asCopy Whether to save as a copy.
|
|
629
|
+
* @minVersion 23.0
|
|
630
|
+
*/
|
|
631
|
+
bmp: (entry: File, saveOptions?: BMPSaveOptions, asCopy?: boolean) => Promise<void>;
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* Duplicates given layer(s), creating all copies above the top most one in layer stack,
|
|
635
|
+
* and returns the newly created layers.
|
|
636
|
+
*
|
|
637
|
+
* @param layers The array of layers to duplicate.
|
|
638
|
+
* @param targetDocument If specified, send the duplicates to a different document.
|
|
639
|
+
*
|
|
640
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#duplicatelayers}
|
|
641
|
+
*
|
|
642
|
+
* @example
|
|
643
|
+
* ```js
|
|
644
|
+
* // duplicate some layers
|
|
645
|
+
* const layerCopies = await document.duplicateLayers([layer1, layer3])
|
|
646
|
+
* layerCopies.forEach((layer) => { layer.blendMode = 'multiply' })
|
|
647
|
+
* ```
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```js
|
|
651
|
+
* // ...to another document
|
|
652
|
+
* const finalDoc = await photoshop.open('~/path/to/collated/image.psd')
|
|
653
|
+
* await document.duplicateLayers([logo1, textLayer1], finalDoc)
|
|
654
|
+
* await finalDoc.close(SaveOptions.SAVECHANGES)
|
|
655
|
+
* ```
|
|
656
|
+
*
|
|
657
|
+
* @async
|
|
658
|
+
* @minVersion 23.0
|
|
659
|
+
*/
|
|
660
|
+
duplicateLayers(layers: Layer[], targetDocument?: Document): Promise<Layer[]>;
|
|
661
|
+
/**
|
|
662
|
+
* Links layers together if possible, and returns a list of linked layers.
|
|
663
|
+
*
|
|
664
|
+
* @param layers Array of layers to link together.
|
|
665
|
+
* @returns Array of successfully linked layers.
|
|
666
|
+
*
|
|
667
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#linklayers}
|
|
668
|
+
* @minVersion 23.0
|
|
669
|
+
*/
|
|
670
|
+
linkLayers(layers: Layer[]): Layer[];
|
|
671
|
+
/**
|
|
672
|
+
* General form of the kind-specific methods below. See those methods for more information.
|
|
673
|
+
* Create a new layer of the given kind. With no arguments, a pixel layer will be created.
|
|
674
|
+
*
|
|
675
|
+
* The options object will have properties specific to the kind,
|
|
676
|
+
* though all layers share a basic set of properties common to all.
|
|
677
|
+
*
|
|
678
|
+
* The override signatures below are provided as type guardrails to
|
|
679
|
+
* help ensure the options provided match the layer kind.
|
|
680
|
+
*
|
|
681
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#createlayer}
|
|
682
|
+
*
|
|
683
|
+
* @example
|
|
684
|
+
* ```js
|
|
685
|
+
* await doc.createLayer(); // defaults to pixel layer
|
|
686
|
+
* await doc.createLayer(
|
|
687
|
+
* constants.LayerKind.NORMAL, // pixel layer
|
|
688
|
+
* {name: "myLayer", opacity: 80, blendMode: constants.BlendMode.COLORDODGE}
|
|
689
|
+
* );
|
|
690
|
+
* ```
|
|
691
|
+
*
|
|
692
|
+
* @async
|
|
693
|
+
* @minVersion 23.0
|
|
694
|
+
*/
|
|
695
|
+
createLayer(): Promise<Layer | null>;
|
|
696
|
+
/**
|
|
697
|
+
* Create a new pixel layer.
|
|
698
|
+
*
|
|
699
|
+
* @param kind The kind of layer to create.
|
|
700
|
+
* @param options The options for creation, including general layer options and those specific to the layer kind.
|
|
701
|
+
*
|
|
702
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#createlayer}
|
|
703
|
+
*
|
|
704
|
+
* @async
|
|
705
|
+
* @minVersion 23.0
|
|
706
|
+
*/
|
|
707
|
+
createLayer(kind: Constants.LayerKind.NORMAL, options?: PixelLayerCreateOptions): Promise<Layer | null>;
|
|
708
|
+
/**
|
|
709
|
+
* Create a new layer group.
|
|
710
|
+
*
|
|
711
|
+
* @param kind The kind of layer to create.
|
|
712
|
+
* @param options The options for creation, including general layer options and those specific to the layer kind.
|
|
713
|
+
*
|
|
714
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#createlayer}
|
|
715
|
+
*
|
|
716
|
+
* @example
|
|
717
|
+
* ```js
|
|
718
|
+
* await doc.createLayer(constants.LayerKind.GROUP, {name: "myLayer", opacity: 80});
|
|
719
|
+
* ```
|
|
720
|
+
*
|
|
721
|
+
* @async
|
|
722
|
+
* @minVersion 24.1
|
|
723
|
+
*/
|
|
724
|
+
createLayer(kind: Constants.LayerKind.GROUP, options?: GroupLayerCreateOptions): Promise<Layer | null>;
|
|
725
|
+
/**
|
|
726
|
+
* Create a pixel layer using options described by PixelLayerCreateOptions.
|
|
727
|
+
*
|
|
728
|
+
* @param options The options for creation.
|
|
729
|
+
*
|
|
730
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#createpixellayer}
|
|
731
|
+
*
|
|
732
|
+
* @example
|
|
733
|
+
* ```js
|
|
734
|
+
* await doc.createPixelLayer()
|
|
735
|
+
* await doc.createPixelLayer({name: "myLayer", opacity: 80, fillNeutral: true})
|
|
736
|
+
* ```
|
|
737
|
+
*
|
|
738
|
+
* @async
|
|
739
|
+
* @minVersion 24.1
|
|
740
|
+
*/
|
|
741
|
+
createPixelLayer(options?: PixelLayerCreateOptions): Promise<Layer | null>;
|
|
742
|
+
/**
|
|
743
|
+
* Create a text layer using options described by TextLayerCreateOptions.
|
|
744
|
+
*
|
|
745
|
+
* @param options The options for creation.
|
|
746
|
+
*
|
|
747
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#createtextlayer}
|
|
748
|
+
*
|
|
749
|
+
* @example
|
|
750
|
+
* ```js
|
|
751
|
+
* await doc.createTextLayer()
|
|
752
|
+
* await doc.createTextLayer({name: "myTextLayer", contents: "Hello, World!", fontSize: 32})
|
|
753
|
+
* ```
|
|
754
|
+
*
|
|
755
|
+
* @async
|
|
756
|
+
* @minVersion 24.2
|
|
757
|
+
*/
|
|
758
|
+
createTextLayer(options?: TextLayerCreateOptions): Promise<Layer | null>;
|
|
759
|
+
/**
|
|
760
|
+
* Create a layer group using options described by GroupLayerCreateOptions.
|
|
761
|
+
*
|
|
762
|
+
* @param options The options for creation.
|
|
763
|
+
*
|
|
764
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#createlayergroup}
|
|
765
|
+
*
|
|
766
|
+
* @example
|
|
767
|
+
* ```js
|
|
768
|
+
* const myEmptyGroup = await doc.createLayerGroup()
|
|
769
|
+
* const myGroup = await doc.createLayerGroup({name: "myLayer", opacity: 80, blendMode: "colorDodge"})
|
|
770
|
+
* const nonEmptyGroup = await doc.createLayerGroup({name: "group", fromLayers: [layer1, layer2]})
|
|
771
|
+
* const selectedGroup = await doc.createLayerGroup({name: "group", fromLayers: doc.activeLayers})
|
|
772
|
+
* ```
|
|
773
|
+
*
|
|
774
|
+
* @async
|
|
775
|
+
* @minVersion 23.0
|
|
776
|
+
*/
|
|
777
|
+
createLayerGroup(options?: GroupLayerCreateOptions): Promise<Layer | null>;
|
|
778
|
+
/**
|
|
779
|
+
* Create a layer group from existing layers.
|
|
780
|
+
*
|
|
781
|
+
* @param layers Array of layers to group.
|
|
782
|
+
*
|
|
783
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#grouplayers}
|
|
784
|
+
*
|
|
785
|
+
* @example
|
|
786
|
+
* ```js
|
|
787
|
+
* const layers = doc.layers
|
|
788
|
+
* const group = await doc.groupLayers([layers[1], layers[2], layers[4]])
|
|
789
|
+
* ```
|
|
790
|
+
*
|
|
791
|
+
* @async
|
|
792
|
+
* @minVersion 23.0
|
|
793
|
+
*/
|
|
794
|
+
groupLayers(layers: Layer[]): Promise<Layer | null>;
|
|
795
|
+
/**
|
|
796
|
+
* Creates a single history state encapsulating everything that is done
|
|
797
|
+
* in the callback, only for this document. All changes to the document should
|
|
798
|
+
* be done in this callback.
|
|
799
|
+
*
|
|
800
|
+
* Note: If you make changes to any other document, those changes will
|
|
801
|
+
* not be suspended in the same history state.
|
|
802
|
+
*
|
|
803
|
+
* The callback is passed in a SuspendHistoryContext object,
|
|
804
|
+
* which contains the current document in a variable `document`.
|
|
805
|
+
*
|
|
806
|
+
* For more info and advanced context, see `core.executeAsModal`
|
|
807
|
+
* API, for which `suspendHistory` is a simple wrapper.
|
|
808
|
+
*
|
|
809
|
+
* @param callback The callback function.
|
|
810
|
+
* @param historyStateName The name for the history state.
|
|
811
|
+
*
|
|
812
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#suspendhistory}
|
|
813
|
+
*
|
|
814
|
+
* @example
|
|
815
|
+
* ```js
|
|
816
|
+
* app.activeDocument.suspendHistory(async (context) => {
|
|
817
|
+
* // context.document below is, in this case, `app.activeDocument`
|
|
818
|
+
* context.document.activeLayers[0].name = "Changed name";
|
|
819
|
+
* });
|
|
820
|
+
* ```
|
|
821
|
+
*
|
|
822
|
+
* @minVersion 23.0
|
|
823
|
+
*/
|
|
824
|
+
suspendHistory(callback: (e: SuspendHistoryContext) => void, historyStateName: string): Promise<void>;
|
|
825
|
+
/**
|
|
826
|
+
* Returns a SolidColor object sampled from the document at the given position.
|
|
827
|
+
*
|
|
828
|
+
* @param position The point to sample `{x: number, y: number}`.
|
|
829
|
+
*
|
|
830
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#samplecolor}
|
|
831
|
+
*
|
|
832
|
+
* @example
|
|
833
|
+
* ```js
|
|
834
|
+
* let col = await app.activeDocument.sampleColor({x: 100, y: 100});
|
|
835
|
+
* console.log(col.rgb);
|
|
836
|
+
* // {
|
|
837
|
+
* // red: 233,
|
|
838
|
+
* // green: 179,
|
|
839
|
+
* // blue: 135,
|
|
840
|
+
* // hexValue: "E9B387"
|
|
841
|
+
* // }
|
|
842
|
+
* ```
|
|
843
|
+
*
|
|
844
|
+
* @param position The point to sample `{x: number, y: number}`.
|
|
845
|
+
* @param position.x The horizontal coordinate in pixels.
|
|
846
|
+
* @param position.y The vertical coordinate in pixels.
|
|
847
|
+
* @returns A SolidColor instance of the sampled pixel.
|
|
848
|
+
*
|
|
849
|
+
* @async
|
|
850
|
+
* @minVersion 24.0
|
|
851
|
+
*/
|
|
852
|
+
sampleColor(position: {
|
|
853
|
+
x: number;
|
|
854
|
+
y: number;
|
|
855
|
+
}): Promise<NoColor | SolidColor>;
|
|
856
|
+
/**
|
|
857
|
+
* The Calculations command lets you blend two individual channels from one or more source images. You can then
|
|
858
|
+
* apply the results to a new image or to a new channel or selection in the active image.
|
|
859
|
+
*
|
|
860
|
+
* Performs Image > Calculations on the document. See the CalculationsOptions
|
|
861
|
+
* object for more info and examples.
|
|
862
|
+
*
|
|
863
|
+
* Known issue: currently calculations requires having exactly one unlocked pixel layer being selected otherwise
|
|
864
|
+
* it won't work. In future there should not be any layer requirements since this cannot output into layer.
|
|
865
|
+
*
|
|
866
|
+
* @param calculationsOptions Option object for the calculations.
|
|
867
|
+
*
|
|
868
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#calculations}
|
|
869
|
+
*
|
|
870
|
+
* @example
|
|
871
|
+
* ```js
|
|
872
|
+
* const doc = app.activeDocument;
|
|
873
|
+
* const options = {
|
|
874
|
+
* source1: {
|
|
875
|
+
* document: doc,
|
|
876
|
+
* layer: doc.layers[0],
|
|
877
|
+
* channel: constants.CalculationsChannel.GRAY
|
|
878
|
+
* invert: true
|
|
879
|
+
* },
|
|
880
|
+
* source2: {
|
|
881
|
+
* document: doc,
|
|
882
|
+
* layer: constants.CalculationsLayer.MERGED,
|
|
883
|
+
* channel: doc.channels[2]
|
|
884
|
+
* },
|
|
885
|
+
* blending: constants.CalculationsBlendMode.DARKEN,
|
|
886
|
+
* opacity: 50,
|
|
887
|
+
* result: constants.CalculationsResult.NEWCHANNEL
|
|
888
|
+
* };
|
|
889
|
+
* doc.calculations(options);
|
|
890
|
+
* ```
|
|
891
|
+
*
|
|
892
|
+
* @async
|
|
893
|
+
* @minVersion 24.5
|
|
894
|
+
*/
|
|
895
|
+
calculations(calculationsOptions: CalculationsOptions): Promise<Document | Channel | void>;
|
|
896
|
+
/**
|
|
897
|
+
* All channels in the document.
|
|
898
|
+
*
|
|
899
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#channels}
|
|
900
|
+
* @minVersion 23.0
|
|
901
|
+
*/
|
|
902
|
+
get channels(): Channels;
|
|
903
|
+
/**
|
|
904
|
+
* Component channels in the document.
|
|
905
|
+
*
|
|
906
|
+
* Updates: [(24.6)](https://developer.adobe.com/photoshop/uxp/2022/ps_reference/changelog/#246-bug-fixes)
|
|
907
|
+
*
|
|
908
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#componentchannels}
|
|
909
|
+
* @minVersion 24.5
|
|
910
|
+
*/
|
|
911
|
+
get componentChannels(): Channel[];
|
|
912
|
+
/**
|
|
913
|
+
* Deprecated since these channels are component not composite.
|
|
914
|
+
* Use `componentChannels` above.
|
|
915
|
+
*
|
|
916
|
+
* @deprecated
|
|
917
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#compositechannels}
|
|
918
|
+
* @minVersion 23.0
|
|
919
|
+
*/
|
|
920
|
+
get compositeChannels(): Channel[];
|
|
921
|
+
/**
|
|
922
|
+
* Currently active channels of the document.
|
|
923
|
+
*
|
|
924
|
+
* Updates: [(24.6)](https://developer.adobe.com/photoshop/uxp/2022/ps_reference/changelog/#246-bug-fixes)
|
|
925
|
+
*
|
|
926
|
+
* @see {@link https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#activechannels}
|
|
927
|
+
* @minVersion 23.0
|
|
928
|
+
*/
|
|
929
|
+
get activeChannels(): Channel[];
|
|
930
|
+
set activeChannels(channels: Channel[]);
|
|
931
|
+
}
|