@alisaitteke/photoshop-mcp 0.1.0
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/.prettierrc +9 -0
- package/README.md +1300 -0
- package/dist/api/batch-play.d.ts +62 -0
- package/dist/api/batch-play.d.ts.map +1 -0
- package/dist/api/batch-play.js +131 -0
- package/dist/api/batch-play.js.map +1 -0
- package/dist/api/extendscript.d.ts +258 -0
- package/dist/api/extendscript.d.ts.map +1 -0
- package/dist/api/extendscript.js +1437 -0
- package/dist/api/extendscript.js.map +1 -0
- package/dist/api/photoshop-api.d.ts +20 -0
- package/dist/api/photoshop-api.d.ts.map +1 -0
- package/dist/api/photoshop-api.js +88 -0
- package/dist/api/photoshop-api.js.map +1 -0
- package/dist/core/server.d.ts +14 -0
- package/dist/core/server.d.ts.map +1 -0
- package/dist/core/server.js +191 -0
- package/dist/core/server.js.map +1 -0
- package/dist/core/session.d.ts +24 -0
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/session.js +83 -0
- package/dist/core/session.js.map +1 -0
- package/dist/core/tool-registry.d.ts +23 -0
- package/dist/core/tool-registry.d.ts.map +1 -0
- package/dist/core/tool-registry.js +55 -0
- package/dist/core/tool-registry.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/platform/connection.d.ts +20 -0
- package/dist/platform/connection.d.ts.map +1 -0
- package/dist/platform/connection.js +94 -0
- package/dist/platform/connection.js.map +1 -0
- package/dist/platform/detector.d.ts +19 -0
- package/dist/platform/detector.d.ts.map +1 -0
- package/dist/platform/detector.js +63 -0
- package/dist/platform/detector.js.map +1 -0
- package/dist/platform/macos-detector.d.ts +13 -0
- package/dist/platform/macos-detector.d.ts.map +1 -0
- package/dist/platform/macos-detector.js +145 -0
- package/dist/platform/macos-detector.js.map +1 -0
- package/dist/platform/macos-executor.d.ts +22 -0
- package/dist/platform/macos-executor.d.ts.map +1 -0
- package/dist/platform/macos-executor.js +161 -0
- package/dist/platform/macos-executor.js.map +1 -0
- package/dist/platform/script-executor.d.ts +23 -0
- package/dist/platform/script-executor.d.ts.map +1 -0
- package/dist/platform/script-executor.js +2 -0
- package/dist/platform/script-executor.js.map +1 -0
- package/dist/platform/windows-detector.d.ts +14 -0
- package/dist/platform/windows-detector.d.ts.map +1 -0
- package/dist/platform/windows-detector.js +173 -0
- package/dist/platform/windows-detector.js.map +1 -0
- package/dist/platform/windows-executor.d.ts +15 -0
- package/dist/platform/windows-executor.d.ts.map +1 -0
- package/dist/platform/windows-executor.js +148 -0
- package/dist/platform/windows-executor.js.map +1 -0
- package/dist/tools/action-tools.d.ts +4 -0
- package/dist/tools/action-tools.d.ts.map +1 -0
- package/dist/tools/action-tools.js +102 -0
- package/dist/tools/action-tools.js.map +1 -0
- package/dist/tools/adjustment-tools.d.ts +4 -0
- package/dist/tools/adjustment-tools.d.ts.map +1 -0
- package/dist/tools/adjustment-tools.js +274 -0
- package/dist/tools/adjustment-tools.js.map +1 -0
- package/dist/tools/document-tools.d.ts +4 -0
- package/dist/tools/document-tools.d.ts.map +1 -0
- package/dist/tools/document-tools.js +230 -0
- package/dist/tools/document-tools.js.map +1 -0
- package/dist/tools/filter-tools.d.ts +4 -0
- package/dist/tools/filter-tools.d.ts.map +1 -0
- package/dist/tools/filter-tools.js +230 -0
- package/dist/tools/filter-tools.js.map +1 -0
- package/dist/tools/history-tools.d.ts +4 -0
- package/dist/tools/history-tools.d.ts.map +1 -0
- package/dist/tools/history-tools.js +137 -0
- package/dist/tools/history-tools.js.map +1 -0
- package/dist/tools/image-placement-tools.d.ts +4 -0
- package/dist/tools/image-placement-tools.d.ts.map +1 -0
- package/dist/tools/image-placement-tools.js +109 -0
- package/dist/tools/image-placement-tools.js.map +1 -0
- package/dist/tools/image-tools.d.ts +4 -0
- package/dist/tools/image-tools.d.ts.map +1 -0
- package/dist/tools/image-tools.js +123 -0
- package/dist/tools/image-tools.js.map +1 -0
- package/dist/tools/layer-ordering-tools.d.ts +4 -0
- package/dist/tools/layer-ordering-tools.d.ts.map +1 -0
- package/dist/tools/layer-ordering-tools.js +210 -0
- package/dist/tools/layer-ordering-tools.js.map +1 -0
- package/dist/tools/layer-properties-tools.d.ts +4 -0
- package/dist/tools/layer-properties-tools.d.ts.map +1 -0
- package/dist/tools/layer-properties-tools.js +421 -0
- package/dist/tools/layer-properties-tools.js.map +1 -0
- package/dist/tools/layer-tools.d.ts +4 -0
- package/dist/tools/layer-tools.d.ts.map +1 -0
- package/dist/tools/layer-tools.js +251 -0
- package/dist/tools/layer-tools.js.map +1 -0
- package/dist/tools/layer-transform-tools.d.ts +4 -0
- package/dist/tools/layer-transform-tools.d.ts.map +1 -0
- package/dist/tools/layer-transform-tools.js +199 -0
- package/dist/tools/layer-transform-tools.js.map +1 -0
- package/dist/tools/selection-tools.d.ts +4 -0
- package/dist/tools/selection-tools.d.ts.map +1 -0
- package/dist/tools/selection-tools.js +295 -0
- package/dist/tools/selection-tools.js.map +1 -0
- package/dist/tools/text-tools.d.ts +4 -0
- package/dist/tools/text-tools.d.ts.map +1 -0
- package/dist/tools/text-tools.js +210 -0
- package/dist/tools/text-tools.js.map +1 -0
- package/dist/utils/logger.d.ts +17 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +43 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for batchPlay API
|
|
3
|
+
* batchPlay is the modern way to execute Photoshop actions in UXP
|
|
4
|
+
*/
|
|
5
|
+
export interface ActionDescriptor {
|
|
6
|
+
_obj: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface BatchPlayOptions {
|
|
10
|
+
synchronousExecution?: boolean;
|
|
11
|
+
modalBehavior?: 'wait' | 'execute' | 'fail';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a batchPlay command template
|
|
15
|
+
*/
|
|
16
|
+
export declare function createBatchPlayCommand(action: string, params?: Record<string, unknown>): ActionDescriptor;
|
|
17
|
+
/**
|
|
18
|
+
* Execute batchPlay commands
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateBatchPlayScript(descriptors: ActionDescriptor[], options?: BatchPlayOptions): string;
|
|
21
|
+
/**
|
|
22
|
+
* Common batchPlay action descriptors
|
|
23
|
+
*/
|
|
24
|
+
export declare const Actions: {
|
|
25
|
+
/**
|
|
26
|
+
* Create a new document
|
|
27
|
+
*/
|
|
28
|
+
newDocument: (width: number, height: number, resolution?: number, colorMode?: string) => ActionDescriptor;
|
|
29
|
+
/**
|
|
30
|
+
* Get active document info
|
|
31
|
+
*/
|
|
32
|
+
getDocumentInfo: () => ActionDescriptor;
|
|
33
|
+
/**
|
|
34
|
+
* Create a text layer
|
|
35
|
+
*/
|
|
36
|
+
createTextLayer: (text: string, x?: number, y?: number) => ActionDescriptor;
|
|
37
|
+
/**
|
|
38
|
+
* Save document
|
|
39
|
+
*/
|
|
40
|
+
saveDocument: (path: string, format?: string) => ActionDescriptor;
|
|
41
|
+
/**
|
|
42
|
+
* Close document
|
|
43
|
+
*/
|
|
44
|
+
closeDocument: (save?: boolean) => ActionDescriptor;
|
|
45
|
+
/**
|
|
46
|
+
* Fill layer with color
|
|
47
|
+
*/
|
|
48
|
+
fillLayer: (red: number, green: number, blue: number) => ActionDescriptor;
|
|
49
|
+
/**
|
|
50
|
+
* Create a new layer
|
|
51
|
+
*/
|
|
52
|
+
newLayer: (name?: string) => ActionDescriptor;
|
|
53
|
+
/**
|
|
54
|
+
* Delete current layer
|
|
55
|
+
*/
|
|
56
|
+
deleteLayer: () => ActionDescriptor;
|
|
57
|
+
/**
|
|
58
|
+
* Resize image
|
|
59
|
+
*/
|
|
60
|
+
resizeImage: (width: number, height: number) => ActionDescriptor;
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=batch-play.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-play.d.ts","sourceRoot":"","sources":["../../src/api/batch-play.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,gBAAgB,CAKlB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,gBAAgB,EAAE,EAC/B,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CAaR;AAED;;GAEG;AACH,eAAO,MAAM,OAAO;IAClB;;OAEG;yBACkB,MAAM,UAAU,MAAM;IAU3C;;OAEG;;IAMH;;OAEG;4BACqB,MAAM;IAc9B;;OAEG;yBACkB,MAAM;IAY3B;;OAEG;;IAOH;;OAEG;qBACc,MAAM,SAAS,MAAM,QAAQ,MAAM;IAgBpD;;OAEG;sBACe,MAAM;IAWxB;;OAEG;;IAMH;;OAEG;yBACkB,MAAM,UAAU,MAAM;CAM5C,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for batchPlay API
|
|
3
|
+
* batchPlay is the modern way to execute Photoshop actions in UXP
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Create a batchPlay command template
|
|
7
|
+
*/
|
|
8
|
+
export function createBatchPlayCommand(action, params = {}) {
|
|
9
|
+
return {
|
|
10
|
+
_obj: action,
|
|
11
|
+
...params,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Execute batchPlay commands
|
|
16
|
+
*/
|
|
17
|
+
export function generateBatchPlayScript(descriptors, options = {}) {
|
|
18
|
+
return `
|
|
19
|
+
const { batchPlay } = require('photoshop').action;
|
|
20
|
+
|
|
21
|
+
const descriptors = ${JSON.stringify(descriptors)};
|
|
22
|
+
const options = ${JSON.stringify({
|
|
23
|
+
synchronousExecution: options.synchronousExecution ?? false,
|
|
24
|
+
modalBehavior: options.modalBehavior ?? 'fail',
|
|
25
|
+
})};
|
|
26
|
+
|
|
27
|
+
const result = await batchPlay(descriptors, options);
|
|
28
|
+
return result;
|
|
29
|
+
`.trim();
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Common batchPlay action descriptors
|
|
33
|
+
*/
|
|
34
|
+
export const Actions = {
|
|
35
|
+
/**
|
|
36
|
+
* Create a new document
|
|
37
|
+
*/
|
|
38
|
+
newDocument: (width, height, resolution = 72, colorMode = 'RGBColorMode') => createBatchPlayCommand('make', {
|
|
39
|
+
_target: [{ _ref: 'document' }],
|
|
40
|
+
width: { _unit: 'pixelsUnit', _value: width },
|
|
41
|
+
height: { _unit: 'pixelsUnit', _value: height },
|
|
42
|
+
resolution: { _unit: 'densityUnit', _value: resolution },
|
|
43
|
+
mode: { _value: colorMode },
|
|
44
|
+
fill: { _enum: 'fill', _value: 'white' },
|
|
45
|
+
}),
|
|
46
|
+
/**
|
|
47
|
+
* Get active document info
|
|
48
|
+
*/
|
|
49
|
+
getDocumentInfo: () => createBatchPlayCommand('get', {
|
|
50
|
+
_target: [{ _property: 'document' }, { _ref: 'application' }],
|
|
51
|
+
}),
|
|
52
|
+
/**
|
|
53
|
+
* Create a text layer
|
|
54
|
+
*/
|
|
55
|
+
createTextLayer: (text, x = 100, y = 100) => createBatchPlayCommand('make', {
|
|
56
|
+
_target: [{ _ref: 'textLayer' }],
|
|
57
|
+
using: {
|
|
58
|
+
_obj: 'textLayer',
|
|
59
|
+
textKey: text,
|
|
60
|
+
textClickPoint: {
|
|
61
|
+
_obj: 'paint',
|
|
62
|
+
horizontal: { _unit: 'pixelsUnit', _value: x },
|
|
63
|
+
vertical: { _unit: 'pixelsUnit', _value: y },
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
/**
|
|
68
|
+
* Save document
|
|
69
|
+
*/
|
|
70
|
+
saveDocument: (path, format = 'Photoshop') => createBatchPlayCommand('save', {
|
|
71
|
+
_target: [{ _ref: 'document', _enum: 'ordinal', _value: 'targetEnum' }],
|
|
72
|
+
as: {
|
|
73
|
+
_obj: format,
|
|
74
|
+
},
|
|
75
|
+
in: {
|
|
76
|
+
_path: path,
|
|
77
|
+
},
|
|
78
|
+
copy: false,
|
|
79
|
+
}),
|
|
80
|
+
/**
|
|
81
|
+
* Close document
|
|
82
|
+
*/
|
|
83
|
+
closeDocument: (save = false) => createBatchPlayCommand('close', {
|
|
84
|
+
_target: [{ _ref: 'document', _enum: 'ordinal', _value: 'targetEnum' }],
|
|
85
|
+
saving: { _enum: 'yesNo', _value: save ? 'yes' : 'no' },
|
|
86
|
+
}),
|
|
87
|
+
/**
|
|
88
|
+
* Fill layer with color
|
|
89
|
+
*/
|
|
90
|
+
fillLayer: (red, green, blue) => createBatchPlayCommand('fill', {
|
|
91
|
+
using: {
|
|
92
|
+
_enum: 'fillContents',
|
|
93
|
+
_value: 'color',
|
|
94
|
+
},
|
|
95
|
+
color: {
|
|
96
|
+
_obj: 'RGBColor',
|
|
97
|
+
red,
|
|
98
|
+
green,
|
|
99
|
+
blue,
|
|
100
|
+
},
|
|
101
|
+
opacity: { _unit: 'percentUnit', _value: 100 },
|
|
102
|
+
mode: { _enum: 'blendMode', _value: 'normal' },
|
|
103
|
+
}),
|
|
104
|
+
/**
|
|
105
|
+
* Create a new layer
|
|
106
|
+
*/
|
|
107
|
+
newLayer: (name) => createBatchPlayCommand('make', {
|
|
108
|
+
_target: [{ _ref: 'layer' }],
|
|
109
|
+
...(name && {
|
|
110
|
+
using: {
|
|
111
|
+
_obj: 'layer',
|
|
112
|
+
name,
|
|
113
|
+
},
|
|
114
|
+
}),
|
|
115
|
+
}),
|
|
116
|
+
/**
|
|
117
|
+
* Delete current layer
|
|
118
|
+
*/
|
|
119
|
+
deleteLayer: () => createBatchPlayCommand('delete', {
|
|
120
|
+
_target: [{ _ref: 'layer', _enum: 'ordinal', _value: 'targetEnum' }],
|
|
121
|
+
}),
|
|
122
|
+
/**
|
|
123
|
+
* Resize image
|
|
124
|
+
*/
|
|
125
|
+
resizeImage: (width, height) => createBatchPlayCommand('imageSize', {
|
|
126
|
+
width: { _unit: 'pixelsUnit', _value: width },
|
|
127
|
+
height: { _unit: 'pixelsUnit', _value: height },
|
|
128
|
+
interfaceIconFrameDimmed: { _enum: 'interpolationType', _value: 'bicubic' },
|
|
129
|
+
}),
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=batch-play.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-play.js","sourceRoot":"","sources":["../../src/api/batch-play.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAc,EACd,SAAkC,EAAE;IAEpC,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,GAAG,MAAM;KACV,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAA+B,EAC/B,UAA4B,EAAE;IAE9B,OAAO;;;sBAGa,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;kBAC/B,IAAI,CAAC,SAAS,CAAC;QAC7B,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,IAAI,KAAK;QAC3D,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,MAAM;KAC/C,CAAC;;;;GAID,CAAC,IAAI,EAAE,CAAC;AACX,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB;;OAEG;IACH,WAAW,EAAE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,GAAG,CAAC,IAAI,IAAI;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,OAAO;gBACb,IAAI;aACL;SACF,CAAC;KACH,CAAC;IAEJ;;OAEG;IACH,WAAW,EAAE,GAAG,EAAE,CAChB,sBAAsB,CAAC,QAAQ,EAAE;QAC/B,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;KACrE,CAAC;IAEJ;;OAEG;IACH,WAAW,EAAE,CAAC,KAAa,EAAE,MAAc,EAAE,EAAE,CAC7C,sBAAsB,CAAC,WAAW,EAAE;QAClC,KAAK,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE;QAC7C,MAAM,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE;QAC/C,wBAAwB,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,SAAS,EAAE;KAC5E,CAAC;CACL,CAAC"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for ExtendScript API
|
|
3
|
+
* ExtendScript is the legacy scripting API for Photoshop
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Common ExtendScript snippets
|
|
7
|
+
*/
|
|
8
|
+
export declare const ExtendScriptSnippets: {
|
|
9
|
+
/**
|
|
10
|
+
* Get Photoshop application info
|
|
11
|
+
*/
|
|
12
|
+
getAppInfo: () => string;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new document
|
|
15
|
+
*/
|
|
16
|
+
newDocument: (width: number, height: number, resolution?: number, colorMode?: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Get active document info
|
|
19
|
+
*/
|
|
20
|
+
getDocumentInfo: () => string;
|
|
21
|
+
/**
|
|
22
|
+
* Create a text layer
|
|
23
|
+
*/
|
|
24
|
+
createTextLayer: (text: string, x?: number, y?: number, fontSize?: number) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Place an image file as a layer
|
|
27
|
+
*/
|
|
28
|
+
placeImage: (filePath: string, x?: number, y?: number) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Open an image file as a new document
|
|
31
|
+
*/
|
|
32
|
+
openImage: (filePath: string) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Save document as PSD
|
|
35
|
+
*/
|
|
36
|
+
saveAsPSD: (path: string) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Save document as JPEG
|
|
39
|
+
*/
|
|
40
|
+
saveAsJPEG: (path: string, quality?: number) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Save document as PNG
|
|
43
|
+
*/
|
|
44
|
+
saveAsPNG: (path: string) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Close active document
|
|
47
|
+
*/
|
|
48
|
+
closeDocument: (save?: boolean) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Create a new layer
|
|
51
|
+
*/
|
|
52
|
+
newLayer: (name?: string) => string;
|
|
53
|
+
/**
|
|
54
|
+
* Delete active layer
|
|
55
|
+
*/
|
|
56
|
+
deleteLayer: () => string;
|
|
57
|
+
/**
|
|
58
|
+
* Fill layer with color
|
|
59
|
+
*/
|
|
60
|
+
fillLayer: (red: number, green: number, blue: number) => string;
|
|
61
|
+
/**
|
|
62
|
+
* Resize image
|
|
63
|
+
*/
|
|
64
|
+
resizeImage: (width: number, height: number) => string;
|
|
65
|
+
/**
|
|
66
|
+
* Get all layer names
|
|
67
|
+
*/
|
|
68
|
+
getLayerNames: () => string;
|
|
69
|
+
/**
|
|
70
|
+
* Select layer by name
|
|
71
|
+
*/
|
|
72
|
+
selectLayer: (name: string) => string;
|
|
73
|
+
/**
|
|
74
|
+
* Scale active layer to fit document (maintain aspect ratio)
|
|
75
|
+
*/
|
|
76
|
+
fitLayerToDocument: (fillDocument?: boolean) => string;
|
|
77
|
+
/**
|
|
78
|
+
* Scale active layer by percentage
|
|
79
|
+
*/
|
|
80
|
+
scaleLayer: (scalePercent: number, centerAnchor?: boolean) => string;
|
|
81
|
+
/**
|
|
82
|
+
* Move/translate active layer
|
|
83
|
+
*/
|
|
84
|
+
moveLayer: (deltaX: number, deltaY: number) => string;
|
|
85
|
+
/**
|
|
86
|
+
* Rotate active layer
|
|
87
|
+
*/
|
|
88
|
+
rotateLayer: (degrees: number) => string;
|
|
89
|
+
/**
|
|
90
|
+
* Set layer opacity
|
|
91
|
+
*/
|
|
92
|
+
setLayerOpacity: (opacity: number) => string;
|
|
93
|
+
/**
|
|
94
|
+
* Set layer blend mode
|
|
95
|
+
*/
|
|
96
|
+
setLayerBlendMode: (blendMode: string) => string;
|
|
97
|
+
/**
|
|
98
|
+
* Set layer visibility
|
|
99
|
+
*/
|
|
100
|
+
setLayerVisibility: (visible: boolean) => string;
|
|
101
|
+
/**
|
|
102
|
+
* Lock/unlock layer
|
|
103
|
+
*/
|
|
104
|
+
setLayerLocked: (locked: boolean) => string;
|
|
105
|
+
/**
|
|
106
|
+
* Rename active layer
|
|
107
|
+
*/
|
|
108
|
+
renameLayer: (newName: string) => string;
|
|
109
|
+
/**
|
|
110
|
+
* Duplicate active layer
|
|
111
|
+
*/
|
|
112
|
+
duplicateLayer: (newName?: string) => string;
|
|
113
|
+
/**
|
|
114
|
+
* Merge visible layers
|
|
115
|
+
*/
|
|
116
|
+
mergeVisibleLayers: () => string;
|
|
117
|
+
/**
|
|
118
|
+
* Flatten image (merge all layers)
|
|
119
|
+
*/
|
|
120
|
+
flattenImage: () => string;
|
|
121
|
+
/**
|
|
122
|
+
* Apply Gaussian Blur filter
|
|
123
|
+
*/
|
|
124
|
+
applyGaussianBlur: (radius: number) => string;
|
|
125
|
+
/**
|
|
126
|
+
* Apply Unsharp Mask (sharpen)
|
|
127
|
+
*/
|
|
128
|
+
applyUnsharpMask: (amount: number, radius: number, threshold: number) => string;
|
|
129
|
+
/**
|
|
130
|
+
* Apply Add Noise filter
|
|
131
|
+
*/
|
|
132
|
+
applyAddNoise: (amount: number, distribution: string, monochromatic: boolean) => string;
|
|
133
|
+
/**
|
|
134
|
+
* Apply Motion Blur filter
|
|
135
|
+
*/
|
|
136
|
+
applyMotionBlur: (angle: number, radius: number) => string;
|
|
137
|
+
/**
|
|
138
|
+
* Adjust brightness and contrast
|
|
139
|
+
*/
|
|
140
|
+
adjustBrightnessContrast: (brightness: number, contrast: number) => string;
|
|
141
|
+
/**
|
|
142
|
+
* Adjust hue and saturation
|
|
143
|
+
*/
|
|
144
|
+
adjustHueSaturation: (hue: number, saturation: number, lightness: number) => string;
|
|
145
|
+
/**
|
|
146
|
+
* Auto levels adjustment
|
|
147
|
+
*/
|
|
148
|
+
autoLevels: () => string;
|
|
149
|
+
/**
|
|
150
|
+
* Auto contrast adjustment
|
|
151
|
+
*/
|
|
152
|
+
autoContrast: () => string;
|
|
153
|
+
/**
|
|
154
|
+
* Desaturate (convert to grayscale without changing color mode)
|
|
155
|
+
*/
|
|
156
|
+
desaturate: () => string;
|
|
157
|
+
/**
|
|
158
|
+
* Invert colors
|
|
159
|
+
*/
|
|
160
|
+
invert: () => string;
|
|
161
|
+
/**
|
|
162
|
+
* Crop document
|
|
163
|
+
*/
|
|
164
|
+
cropDocument: (left: number, top: number, right: number, bottom: number) => string;
|
|
165
|
+
/**
|
|
166
|
+
* Set text layer font
|
|
167
|
+
*/
|
|
168
|
+
setTextFont: (fontName: string, fontSize?: number) => string;
|
|
169
|
+
/**
|
|
170
|
+
* Set text color
|
|
171
|
+
*/
|
|
172
|
+
setTextColor: (red: number, green: number, blue: number) => string;
|
|
173
|
+
/**
|
|
174
|
+
* Set text alignment
|
|
175
|
+
*/
|
|
176
|
+
setTextAlignment: (alignment: string) => string;
|
|
177
|
+
/**
|
|
178
|
+
* Update text content
|
|
179
|
+
*/
|
|
180
|
+
updateTextContent: (newText: string) => string;
|
|
181
|
+
/**
|
|
182
|
+
* Create rectangular selection
|
|
183
|
+
*/
|
|
184
|
+
selectRectangle: (left: number, top: number, right: number, bottom: number) => string;
|
|
185
|
+
/**
|
|
186
|
+
* Select all
|
|
187
|
+
*/
|
|
188
|
+
selectAll: () => string;
|
|
189
|
+
/**
|
|
190
|
+
* Deselect
|
|
191
|
+
*/
|
|
192
|
+
deselect: () => string;
|
|
193
|
+
/**
|
|
194
|
+
* Invert selection
|
|
195
|
+
*/
|
|
196
|
+
invertSelection: () => string;
|
|
197
|
+
/**
|
|
198
|
+
* Create layer mask from selection
|
|
199
|
+
*/
|
|
200
|
+
createLayerMask: () => string;
|
|
201
|
+
/**
|
|
202
|
+
* Delete layer mask
|
|
203
|
+
*/
|
|
204
|
+
deleteLayerMask: () => string;
|
|
205
|
+
/**
|
|
206
|
+
* Apply layer mask
|
|
207
|
+
*/
|
|
208
|
+
applyLayerMask: () => string;
|
|
209
|
+
/**
|
|
210
|
+
* Play an action from Actions palette
|
|
211
|
+
*/
|
|
212
|
+
playAction: (actionName: string, actionSetName: string) => string;
|
|
213
|
+
/**
|
|
214
|
+
* Execute custom JavaScript code
|
|
215
|
+
*/
|
|
216
|
+
executeCustomScript: (code: string) => string;
|
|
217
|
+
/**
|
|
218
|
+
* Rasterize active layer
|
|
219
|
+
*/
|
|
220
|
+
rasterizeLayer: () => string;
|
|
221
|
+
/**
|
|
222
|
+
* Undo last operation (step backward in history)
|
|
223
|
+
*/
|
|
224
|
+
undo: (steps?: number) => string;
|
|
225
|
+
/**
|
|
226
|
+
* Redo operation (step forward in history)
|
|
227
|
+
*/
|
|
228
|
+
redo: (steps?: number) => string;
|
|
229
|
+
/**
|
|
230
|
+
* Get history states
|
|
231
|
+
*/
|
|
232
|
+
getHistoryStates: () => string;
|
|
233
|
+
/**
|
|
234
|
+
* Move layer to specific position (reorder)
|
|
235
|
+
*/
|
|
236
|
+
moveLayerToPosition: (targetLayerName: string, position: string) => string;
|
|
237
|
+
/**
|
|
238
|
+
* Move layer to top of layer stack
|
|
239
|
+
*/
|
|
240
|
+
moveLayerToTop: () => string;
|
|
241
|
+
/**
|
|
242
|
+
* Move layer to bottom of layer stack
|
|
243
|
+
*/
|
|
244
|
+
moveLayerToBottom: () => string;
|
|
245
|
+
/**
|
|
246
|
+
* Move layer up one position
|
|
247
|
+
*/
|
|
248
|
+
moveLayerUp: () => string;
|
|
249
|
+
/**
|
|
250
|
+
* Move layer down one position
|
|
251
|
+
*/
|
|
252
|
+
moveLayerDown: () => string;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Generate ExtendScript code with error handling
|
|
256
|
+
*/
|
|
257
|
+
export declare function generateExtendScript(code: string): string;
|
|
258
|
+
//# sourceMappingURL=extendscript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extendscript.d.ts","sourceRoot":"","sources":["../../src/api/extendscript.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8DH;;GAEG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;OAEG;;IASH;;OAEG;yBACkB,MAAM,UAAU,MAAM;IAW3C;;OAEG;;IAYH;;OAEG;4BACqB,MAAM;IAwB9B;;OAEG;2BACoB,MAAM;IAwC7B;;OAEG;0BACmB,MAAM;IAe5B;;OAEG;sBACe,MAAM;IAYxB;;OAEG;uBACgB,MAAM;IAazB;;OAEG;sBACe,MAAM;IAYxB;;OAEG;;IAUH;;OAEG;sBACe,MAAM;IAkBxB;;OAEG;;IAaH;;OAEG;qBACc,MAAM,SAAS,MAAM,QAAQ,MAAM;IAapD;;OAEG;yBACkB,MAAM,UAAU,MAAM;IAiB3C;;OAEG;;IA4BH;;OAEG;wBACiB,MAAM;IAc1B;;OAEG;;IA8DH;;OAEG;+BACwB,MAAM;IAoBjC;;OAEG;wBACiB,MAAM,UAAU,MAAM;IAoB1C;;OAEG;2BACoB,MAAM;IAmB7B;;OAEG;+BACwB,MAAM;IAqBjC;;OAEG;mCAC4B,MAAM;IAqBrC;;OAEG;kCAC2B,OAAO;IAerC;;OAEG;6BACsB,OAAO;IAehC;;OAEG;2BACoB,MAAM;IAgB7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