@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.
Files changed (88) hide show
  1. package/README.md +138 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +7049 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist-readmes/README.md +383 -0
  6. package/dist-runtime/runtime-code.cjs +17124 -0
  7. package/dist-runtime/runtime-code.d.cts +9 -0
  8. package/dist-schemas/@adobe-uxp-types/photoshop/src/index.d.ts +16 -0
  9. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/all-types.d.ts +65 -0
  10. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Actions.d.ts +230 -0
  11. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Channel.d.ts +120 -0
  12. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/ColorSampler.d.ts +105 -0
  13. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Constants.d.ts +1648 -0
  14. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/CoreModules.d.ts +922 -0
  15. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/CountItem.d.ts +86 -0
  16. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Document.d.ts +931 -0
  17. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Guide.d.ts +105 -0
  18. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/HistoryState.d.ts +74 -0
  19. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/ImagingModule.d.ts +559 -0
  20. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Layer.d.ts +1073 -0
  21. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/LayerComp.d.ts +219 -0
  22. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Objects.d.ts +7 -0
  23. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/PathItem.d.ts +243 -0
  24. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/PathPoint.d.ts +78 -0
  25. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Photoshop.d.ts +317 -0
  26. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/Selection.d.ts +557 -0
  27. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/SubPathItem.d.ts +69 -0
  28. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/TextItem.d.ts +213 -0
  29. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Channels.d.ts +81 -0
  30. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/ColorSamplers.d.ts +97 -0
  31. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/CountItems.d.ts +130 -0
  32. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Documents.d.ts +95 -0
  33. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Guides.d.ts +76 -0
  34. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/HistoryStates.d.ts +56 -0
  35. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/LayerComps.d.ts +92 -0
  36. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/Layers.d.ts +68 -0
  37. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/PathItems.d.ts +65 -0
  38. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/PathPoints.d.ts +50 -0
  39. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/SubPathItems.d.ts +50 -0
  40. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/collections/TextFonts.d.ts +43 -0
  41. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/Colors.d.ts +225 -0
  42. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/ConversionOptions.d.ts +213 -0
  43. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/ImagingBounds.d.ts +53 -0
  44. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/PathPointInfo.d.ts +84 -0
  45. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/SaveOptions.d.ts +376 -0
  46. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/SolidColor.d.ts +118 -0
  47. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/SubPathInfo.d.ts +47 -0
  48. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/TextFont.d.ts +49 -0
  49. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/objects/Tool.d.ts +23 -0
  50. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/Preferences.d.ts +121 -0
  51. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesBase.d.ts +9 -0
  52. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesCursors.d.ts +37 -0
  53. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesFileHandling.d.ts +58 -0
  54. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesGeneral.d.ts +77 -0
  55. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesGuidesGridsAndSlices.d.ts +51 -0
  56. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesHistory.d.ts +69 -0
  57. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesInterface.d.ts +46 -0
  58. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesPerformance.d.ts +42 -0
  59. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesTools.d.ts +44 -0
  60. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesTransparencyAndGamut.d.ts +38 -0
  61. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesType.d.ts +44 -0
  62. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/preferences/PreferencesUnitsAndRulers.d.ts +44 -0
  63. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/text/CharacterStyle.d.ts +254 -0
  64. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/text/ParagraphStyle.d.ts +114 -0
  65. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/text/TextWarpStyle.d.ts +48 -0
  66. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/ApplyImageTypes.d.ts +107 -0
  67. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/CalculationsTypes.d.ts +119 -0
  68. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/DocumentTypes.d.ts +80 -0
  69. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/LayerCompTypes.d.ts +91 -0
  70. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/LayerTypes.d.ts +153 -0
  71. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/SharedTypes.d.ts +6 -0
  72. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/dom/types/TextTypes.d.ts +218 -0
  73. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/util/colorTypes.d.ts +61 -0
  74. package/dist-schemas/@adobe-uxp-types/photoshop/src/internal/util/unit.d.ts +45 -0
  75. package/dist-schemas/@adobe-uxp-types/uxp/src/index.d.ts +21 -0
  76. package/dist-schemas/@adobe-uxp-types/uxp/src/internal/all-types.d.ts +3 -0
  77. package/dist-schemas/@adobe-uxp-types/uxp/src/internal/dialog.d.ts +26 -0
  78. package/dist-schemas/@adobe-uxp-types/uxp/src/internal/entrypoints.d.ts +385 -0
  79. package/dist-schemas/@adobe-uxp-types/uxp/src/internal/host.d.ts +28 -0
  80. package/dist-schemas/@adobe-uxp-types/uxp/src/internal/os.d.ts +56 -0
  81. package/dist-schemas/@adobe-uxp-types/uxp/src/internal/other.d.ts +7 -0
  82. package/dist-schemas/@adobe-uxp-types/uxp/src/internal/shell.d.ts +54 -0
  83. package/dist-schemas/@adobe-uxp-types/uxp/src/internal/storage.d.ts +1216 -0
  84. package/dist-schemas/@adobe-uxp-types/uxp/src/internal/versions.d.ts +18 -0
  85. package/dist-schemas/@bubblydoo/uxp-toolkit/dist/commands-library/index.d.ts +109 -0
  86. package/dist-schemas/@bubblydoo/uxp-toolkit/dist/index.d.ts +153 -0
  87. package/dist-schemas/@bubblydoo/uxp-toolkit/dist/psLayerRef-BJKcxKbm.d.ts +66 -0
  88. package/package.json +51 -0
@@ -0,0 +1,559 @@
1
+ /**
2
+ * Image data is represented by a PhotoshopImageData instance.
3
+ * @targetfolder objects/returnobjects
4
+ */
5
+ export interface PhotoshopImageData {
6
+ /**
7
+ * Return pixel information from an `PhotoshopImageData` instance as a typed array.
8
+ * The return type depends on the `componentSize` of the image.
9
+ *
10
+ * | Component Size | Return type |
11
+ * | -------------- | ----------- |
12
+ * | 8 | Uint8Array |
13
+ * | 16 | Uint16Array |
14
+ * | 32 | Float32Array |
15
+ *
16
+ * Example:
17
+ * ```javascript
18
+ * const pixelData = await imageObj.imageData.getData()
19
+ * ```
20
+ * @param options
21
+ */
22
+ getData: (options: GetDataOptions) => Promise<Uint8Array | Uint16Array | Float32Array>;
23
+ /**
24
+ * Calling this synchronous method will release the contained image data. Doing so will reduce memory
25
+ * usage faster then waiting for the JavaScript garbage collector to run.
26
+ *
27
+ * ```javascript
28
+ * pixelData.dispose();
29
+ * ```
30
+ */
31
+ dispose: () => Promise<void>;
32
+ /**
33
+ * The width of the image data in pixels.
34
+ */
35
+ width: number;
36
+ /**
37
+ * The height of the image data in pixels.
38
+ */
39
+ height: number;
40
+ /**
41
+ * The color space (or mode) for the image data.
42
+ */
43
+ colorSpace: ColorSpace;
44
+ /**
45
+ * The color profile for the image data. For example, `"sRGB IEC61966-2.1"`. If the color profile is empty,
46
+ * then the profile of a target document will be used.
47
+ */
48
+ colorProfile: string;
49
+ /**
50
+ * True if the image data includes an alpha channel.
51
+ */
52
+ hasAlpha: boolean;
53
+ /**
54
+ * Number of components per pixel. This is 3 for RGB, 4 for RGBA and so forth.
55
+ */
56
+ components: number;
57
+ /**
58
+ * Number of bits per component. This can be 8, 16, or 32.
59
+ */
60
+ componentSize: 8 | 16 | 32;
61
+ /**
62
+ * Memory layout (order) of components in a pixel.
63
+ */
64
+ pixelFormat: PixelFormat;
65
+ /**
66
+ * True if the image data internally is using the chunky format.
67
+ */
68
+ chunky: boolean;
69
+ /**
70
+ * Type of contained data. At the moment only "image/uncompressed" is supported.
71
+ */
72
+ type: Type;
73
+ }
74
+ /**
75
+ * Options describing the operation.
76
+ * @optionobject
77
+ * @targetfolder objects/options
78
+ * @minVersion 24.4
79
+ */
80
+ export interface GetPixelsOptions {
81
+ /**
82
+ * The id of the source document. If missing, or negative, then the source is the active document.
83
+ * @minVersion 24.4
84
+ */
85
+ documentID?: number;
86
+ /**
87
+ * The id of the source layer. If the value is not provided then the API returns pixels
88
+ * from the composite document image.
89
+ * @minVersion 24.4
90
+ */
91
+ layerID?: number;
92
+ /**
93
+ * The region whose pixels should be returned. If the value is not provided, then pixels from the entire
94
+ * layer or document are is returned. The provided bounds will be trimmed to only that region that contains
95
+ * pixel data. In this event, the returned `sourceBounds` will reflect this smaller region.
96
+ * @minVersion 24.4
97
+ */
98
+ sourceBounds?: ImagingBounds2;
99
+ /**
100
+ * The dimensions of the returned image. If this value is not provided then the returned size will match
101
+ * the requested size. That is, no scaling will be performed on the returned pixels.
102
+ * @minVersion 24.4
103
+ */
104
+ targetSize?: Size;
105
+ /**
106
+ * Requested color space of the returned pixels. If omitted, then the color space of the source document
107
+ * is used to convert colors.
108
+ * @minVersion 24.4
109
+ */
110
+ colorSpace?: string;
111
+ /**
112
+ * The name of a color profile to apply to the returned pixels. If omitted, then the resulting color profile
113
+ * depends on the requested color space:
114
+ * - If the requested color space matches the source document, then the returned data will use the color
115
+ * profile of the source document.
116
+ * - If the requested color space is different from the source document, then the working color profile for
117
+ * that color space is used to convert colors.
118
+ * @minVersion 24.4
119
+ */
120
+ colorProfile?: string;
121
+ /**
122
+ * The requested `componentSize` of the returned image data. If this property is omitted then the
123
+ * `componentSize` of the source pixel data is used. The value can be: -1
124
+ * (for using the source document's depth), 8, 16, or 32.
125
+ * @minVersion 24.4
126
+ */
127
+ componentSize?: ComponentSize;
128
+ /**
129
+ * If true, then RGBA pixels will be converted to RGB by matting on white.
130
+ * The returned imageData property will not contain an alpha channel. Note that any areas devoid of pixel
131
+ * data will still be trimmed, see `sourceBounds` above.
132
+ * @minVersion 24.4
133
+ */
134
+ applyAlpha?: boolean;
135
+ }
136
+ /**
137
+ * @targetfolder objects/returnobjects
138
+ * @minVersion 24.4
139
+ */
140
+ export interface GetPixelsResult {
141
+ /**
142
+ * A `PhotoshopImageData` instance describing the returned pixel data.
143
+ * @minVersion 24.4
144
+ */
145
+ imageData: PhotoshopImageData;
146
+ /**
147
+ * The actual bounds used when obtaining pixels (see note regarding pyramid levels below).
148
+ * @minVersion 24.4
149
+ */
150
+ sourceBounds: ImagingBounds2;
151
+ /**
152
+ * The pyramid level that was used when obtaining pixels.
153
+ * @minVersion 24.4
154
+ */
155
+ level: number;
156
+ }
157
+ export interface PutPixelsOptions {
158
+ documentID?: number;
159
+ layerID: number;
160
+ imageData: PhotoshopImageData;
161
+ replace?: boolean;
162
+ targetBounds?: BoundsSize | ImagingBounds2;
163
+ commandName?: string;
164
+ }
165
+ export interface GetLayerMaskOptions {
166
+ documentID?: number;
167
+ layerID: number;
168
+ kind?: 'user' | 'vector';
169
+ sourceBounds?: ImagingBounds2;
170
+ targetSize?: Size;
171
+ }
172
+ export interface GetLayerMaskResult {
173
+ imageData: PhotoshopImageData;
174
+ sourceBounds: ImagingBounds2;
175
+ }
176
+ export interface PutLayerMaskOptions {
177
+ documentID?: number;
178
+ layerID: number;
179
+ kind?: 'user';
180
+ imageData: PhotoshopImageData;
181
+ replace?: boolean;
182
+ targetBounds?: BoundsSize | ImagingBounds2;
183
+ commandName?: string;
184
+ }
185
+ export interface GetSelectionOptions {
186
+ documentID?: number;
187
+ sourceBounds?: ImagingBounds2;
188
+ targetSize?: Size;
189
+ }
190
+ export interface GetSelectionResult {
191
+ imageData: PhotoshopImageData;
192
+ sourceBounds: ImagingBounds2;
193
+ }
194
+ export interface PutSelectionOptions {
195
+ documentID?: number;
196
+ replace?: boolean;
197
+ imageData: PhotoshopImageData;
198
+ targetBounds?: BoundsSize | ImagingBounds2;
199
+ commandName?: string;
200
+ }
201
+ /**
202
+ * @optionobject
203
+ * @targetfolder objects/options
204
+ * @minVersion 24.4
205
+ */
206
+ export interface CreateImageDataFromBufferOptions {
207
+ /**
208
+ * The width of the image.
209
+ * @minVersion 24.4
210
+ */
211
+ width: number;
212
+ /**
213
+ * The height of the image.
214
+ * @minVersion 24.4
215
+ */
216
+ height: number;
217
+ /**
218
+ * Number of components per pixel.
219
+ * @minVersion 24.4
220
+ */
221
+ components: number;
222
+ /**
223
+ * Describes pixel layout. See discussion above. The default value is true.
224
+ * @minVersion 24.4
225
+ */
226
+ chunky?: boolean;
227
+ /**
228
+ * Describes the color profile associated with the image data. See note regarding color profiles and 32 bit
229
+ * pixel data at the beginning of this document.
230
+ * @minVersion 24.4
231
+ */
232
+ colorProfile?: string;
233
+ /**
234
+ * Describes the color space associated with the image data.
235
+ * @minVersion 24.4
236
+ */
237
+ colorSpace: string;
238
+ /**
239
+ * This value is only used for 16 bit data. Set to true if you are providing pixel data that use
240
+ * the full 16 bit range [0..65535]. Set to false if data is using the reduced range: [0..32768].
241
+ * The default value is false.
242
+ * @minVersion 24.4
243
+ */
244
+ fullRange?: boolean;
245
+ }
246
+ /**
247
+ * @optionobject
248
+ * @targetfolder objects/options
249
+ * @minVersion 24.4
250
+ */
251
+ export interface EncodeImageDataOptions {
252
+ /**
253
+ * A `PhotoshopImageData` instance describing the pixel data.
254
+ * @minVersion 24.4
255
+ */
256
+ imageData: PhotoshopImageData;
257
+ /**
258
+ * If provided, then the returned value will be a string that is base64 encoded.
259
+ * @minVersion 24.4
260
+ */
261
+ base64?: boolean;
262
+ }
263
+ /**
264
+ * @optionobject
265
+ * @targetfolder objects/options
266
+ * @minVersion 24.4
267
+ */
268
+ export interface GetDataOptions {
269
+ /**
270
+ * If true then the data is returned as chunky data. If false, then data is returned in the planar format.
271
+ * The default value is true.
272
+ * @minVersion 24.4
273
+ */
274
+ chunky?: boolean;
275
+ /**
276
+ * This value is only used for 16 bit data. If true then the returned 16 bit pixel data use the full
277
+ * 16 bit range [0..65535]. If false, then the returned pixel data use the reduced Photoshop range: [0..32768].
278
+ * The default value is false.
279
+ * @minVersion 24.4
280
+ */
281
+ fullRange?: boolean;
282
+ }
283
+ export interface ImagingBounds2 {
284
+ left: number;
285
+ top: number;
286
+ bottom: number;
287
+ right: number;
288
+ }
289
+ export interface BoundsSize {
290
+ left: number;
291
+ top: number;
292
+ width: number;
293
+ height: number;
294
+ }
295
+ /**
296
+ * If only one dimension is included, then the returned image data is scaled proportionally to match
297
+ * the requested dimension.
298
+ * @optionobject
299
+ * @targetfolder objects/options
300
+ * @minVersion 24.4
301
+ */
302
+ export interface Size {
303
+ width?: number;
304
+ height?: number;
305
+ }
306
+ /**
307
+ * @minVersion 24.4
308
+ */
309
+ export type PixelFormat = 'RGB' | 'RGBA' | 'Grayscale' | 'GrayscaleAlpha' | 'LAB' | 'LABAlpha';
310
+ /**
311
+ * @minVersion 24.4
312
+ */
313
+ export type Type = 'image/uncompressed';
314
+ /**
315
+ * @minVersion 24.4
316
+ */
317
+ export type ColorSpace = 'RGB' | 'Grayscale' | 'Lab';
318
+ /**
319
+ * @minVersion 24.4
320
+ */
321
+ export type ComponentSize = -1 | 8 | 16 | 32;
322
+
323
+ /**
324
+ * The Imaging API allows JavaScript to work directly with image data in Photoshop documents.
325
+ *
326
+ * The Imaging API are exposed on the `imaging` sub-module under "photoshop". You can access
327
+ * these APIs by using the follow code:
328
+ *
329
+ * ```javascript
330
+ * const imaging = require("photoshop").imaging;
331
+ * ```
332
+ *
333
+ * @minVersion 24.4
334
+ */
335
+ export interface Imaging {
336
+ /**
337
+ * This API allows JavaScript to obtain pixel data from a Photoshop document.
338
+ * You can request pixels from an individual layer, or from the full document composite.
339
+ *
340
+ * ```javascript
341
+ * const imageObj = await imaging.getPixels(options);
342
+ * ```
343
+ *
344
+ * Note: the `components` property of the image data depends on whether or not the pixel source
345
+ * includes an alpha channel, e.g., 4 for RGBA.
346
+ *
347
+ * If the targetSize is smaller than the requested region, then the resulting image data will
348
+ * be scaled down. When scaling, Photoshop may use a smaller (cached) version of the image canvas.
349
+ * This is known as a pyramid level. The number of pyramid levels that are available in a document
350
+ * is determined by the preference: *"Performance Cache Levels"*. Using a cache level may result in
351
+ * dramatic performance improvements. The returned level indicates which level that was used.
352
+ * Level 0 indicates the full resolution canvas. Level 1 indicates a cache that is half of the
353
+ * size of the full resolution, and so forth. The returned `sourceBounds` are relative to the
354
+ * bounds of the source cache level (not relative to the full resolution bounds).
355
+ *
356
+ * The valid bounds for the `sourceBounds` depend on the pixel source. The origin of the composite
357
+ * image is `(0, 0)`,and the size is given by the properties `width` and `height` on the DOM object
358
+ * for the source document. The origin of a pixel layer can be different from `(0, 0)`. You can get
359
+ * the valid pixel bounds for a layer by calling `boundsNoEffects` on the DOM object corresponding
360
+ * to the source layer.
361
+ *
362
+ * Example - create a thumbnail of an region of the target document that is 100 pixels tall.
363
+ * ```javascript
364
+ * const thumbnail = await imaging.getPixels({
365
+ * sourceBounds: { left: 0, top: 0, right: 300, bottom: 300 },
366
+ * targetSize: { height: 100 }
367
+ * });
368
+ * ```
369
+ *
370
+ * @minVersion 24.4
371
+ * @async
372
+ */
373
+ getPixels: (options: GetPixelsOptions) => Promise<GetPixelsResult>;
374
+ /**
375
+ * This API allows JavaScript to change pixel data in a layer. You can replace all pixels
376
+ * in a layer or a region of the layer.
377
+ *
378
+ * ```javascript
379
+ * await imaging.putPixels(options);
380
+ * ```
381
+ *
382
+ * @minVersion 24.4
383
+ * @async
384
+ */
385
+ putPixels: (options: PutPixelsOptions) => Promise<void>;
386
+ /**
387
+ * This API allows JavaScript to retrieve the pixel data representing a layer's mask.
388
+ * ```javascript
389
+ * const imageObj = await imaging.getLayerMask(options);
390
+ * ```
391
+ *
392
+ * Example - get the user mask for a layer
393
+ * ```javascript
394
+ * const imageObj = await imaging.getLayerMask({
395
+ * documentID: 123,
396
+ * layerID: 5,
397
+ * kind: "user"
398
+ * sourceBounds: { left: 0, top: 0, right: 300, bottom: 300 },
399
+ * targetSize: { height: 100 }
400
+ * });
401
+ * ```
402
+ *
403
+ * @minVersion 24.4
404
+ * @async
405
+ */
406
+ getLayerMask: (options: GetLayerMaskOptions) => Promise<GetLayerMaskResult>;
407
+ /**
408
+ * This API allows JavaScript to edit the pixels of a layer's mask. At this time, only pixel
409
+ * masks are editable. In the UI, they are what is referred to as a "Layer Mask".
410
+ *
411
+ * ```javascript
412
+ * await imaging.putLayerMask(options);
413
+ * ```
414
+ *
415
+ * Example:
416
+ * ```javascript
417
+ * await imaging.putLayerMask({
418
+ * layerID: 123
419
+ * imageData: grayImageData
420
+ * });
421
+ * ```
422
+ *
423
+ * @minVersion 24.4
424
+ * @async
425
+ */
426
+ putLayerMask: (options: PutLayerMaskOptions) => Promise<void>;
427
+ /**
428
+ * This API allows JavaScript to obtain a pixel representation of the active selection.
429
+ * Think of it like entering [Quick Mask mode](https://helpx.adobe.com/photoshop/using/create-temporary-quick-mask.html).
430
+ * ```javascript
431
+ * const imageObj = await imaging.getSelection(options);
432
+ * ```
433
+ *
434
+ * Example - get the document selection
435
+ * ```javascript
436
+ * const imageObj = await imaging.getSelection({
437
+ * documentID: 123,
438
+ * sourceBounds: { left: 0, top: 0, right: 300, bottom: 300 }
439
+ * });
440
+ * ```
441
+ *
442
+ * @minVersion 24.4
443
+ * @async
444
+ */
445
+ getSelection: (options: GetSelectionOptions) => Promise<GetSelectionResult>;
446
+ /**
447
+ * This API allows JavaScript to change the selection itself using a provided pixel data representation.
448
+ * Think of it like exiting [Quick Mask mode](https://helpx.adobe.com/photoshop/using/create-temporary-quick-mask.html).
449
+ *
450
+ * ```javascript
451
+ * await imaging.putSelection(options);
452
+ * ```
453
+ *
454
+ * Example:
455
+ * ```javascript
456
+ * await imaging.putSelection({ imageData: grayImageData });
457
+ * ```
458
+ *
459
+ * @minVersion 24.4
460
+ * @async
461
+ */
462
+ putSelection: (options: PutSelectionOptions) => Promise<void>;
463
+ /**
464
+ * This API allows JavaScript to create arbitrary image data from a memory buffer.
465
+ *
466
+ * ```javascript
467
+ * const imageData = await imaging.createImageDataFromBuffer(arrayBuffer, options);
468
+ * ```
469
+ *
470
+ * The number of elements in imageData must be equal to: `width * height * components`.
471
+ *
472
+ * Example:
473
+ * ```javascript
474
+ * const width = 30;
475
+ * const height = 40;
476
+ * const components = 4; // RGBA
477
+ * const componentCount = width * height;
478
+ * const dataSize = componentCount * components;
479
+ * const arrayBuffer = new Uint8Array(dataSize);
480
+ *
481
+ * // Add some (chunky) data to the buffer
482
+ * for (let i = 0 ; i < componentCount; i += components) {
483
+ * arrayBuffer[index] = 255; // red
484
+ * arrayBuffer[index+1] = 0; // green
485
+ * arrayBuffer[index+2] = 0; // blue
486
+ * arrayBuffer[index+3] = 127; // alpha
487
+ * }
488
+ *
489
+ * const options = {
490
+ * width: width,
491
+ * height: height,
492
+ * components: components,
493
+ * colorProfile: "sRGB IEC61966-2.1",
494
+ * colorSpace: "RGB"
495
+ * };
496
+ * const imageData = await imaging.createImageDataFromBuffer(arrayBuffer, options)
497
+ * ```
498
+ *
499
+ * Image data that is used for layer masks or document selections uses a single grayscale component.
500
+ * When creating such data, use `components: 1`, `colorSpace: "Grayscale"`
501
+ * and `colorProfile: "Gray Gamma 2.2"` as shown in the following example:
502
+ *
503
+ * ```javascript
504
+ * const width = 30;
505
+ * const height = 40;
506
+ * const componentCount = width * height;
507
+ * const arrayBuffer = new Uint8Array(componentCount);
508
+ *
509
+ * for (let i = 0 ; i < componentCount; ++i) {
510
+ * arrayBuffer[i] = 127; // all set to the median value
511
+ * }
512
+ *
513
+ * const options = {
514
+ * width: width,
515
+ * height: height,
516
+ * components: 1, // masks are grayscale
517
+ * chunky: false,
518
+ * colorProfile: "Gray Gamma 2.2",
519
+ * colorSpace: "Grayscale"
520
+ * };
521
+ * const maskData = await imaging.createImageDataFromBuffer(arrayBuffer, options)
522
+ * ```
523
+ *
524
+ * @minVersion 24.4
525
+ * @async
526
+ */
527
+ createImageDataFromBuffer: (
528
+ arrayBuffer: Uint8Array | Uint16Array | Float32Array,
529
+ options: CreateImageDataFromBufferOptions,
530
+ ) => Promise<PhotoshopImageData>;
531
+ /**
532
+ * This API is exposed to allow image data to be used with UXP image elements. With the current version of UXP
533
+ * you must use jpeg/base64 encoding when assigning to an image element.
534
+ *
535
+ * ```javascript
536
+ * const dataImage = await imaging.encodeImageData(options);
537
+ * ```
538
+ *
539
+ * Example:
540
+ * ```javascript
541
+ * const imageElement = document.createElement('img');
542
+ *
543
+ * const jpegData = await imaging.encodeImageData({"imageData": imgObj.imageData, "base64": true});
544
+ *
545
+ * const dataUrl = "data:image/jpeg;base64," + jpegData;
546
+ * imageElement.src = dataUrl;
547
+ * document.body.appendChild(imageElement);
548
+ * ```
549
+ *
550
+ * @minVersion 24.4
551
+ * @async
552
+ */
553
+ encodeImageData: (options: EncodeImageDataOptions) => Promise<number[] | string>;
554
+ }
555
+
556
+ /**
557
+ * The Imaging API allows JavaScript to work directly with image data in Photoshop documents.
558
+ */
559
+ export const imaging: Imaging;