workbuddy-layered-psd-bridge 1.1.0 → 1.2.1
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 +28 -24
- package/package.json +4 -1
- package/ps_backend/README.md +6 -4
- package/ps_backend/build_template.jsx +67 -7
- package/ps_backend/cli.mjs +365 -12
- package/ps_backend/tests/font_selection.test.mjs +80 -0
- package/ps_backend/tests/production_preflight.test.mjs +120 -0
- package/src/direct.mjs +30 -8
- package/src/duplicate-audit-core.mjs +217 -0
- package/src/duplicate-audit-runner.mjs +105 -0
- package/src/prepare-worker.mjs +1 -0
- package/src/quality.mjs +204 -0
- package/src/server.mjs +26 -4
- package/src/worker.mjs +55 -1
package/README.md
CHANGED
|
@@ -1,42 +1,46 @@
|
|
|
1
|
-
# WorkBuddy Layered PSD Bridge 1.1
|
|
1
|
+
# WorkBuddy Layered PSD Bridge 1.2.1 candidate
|
|
2
2
|
|
|
3
|
-
Create a
|
|
3
|
+
Create a native layered Photoshop PSD from a structured poster plan in WorkBuddy. Ardot is optional. The default route needs WorkBuddy and Windows desktop Photoshop on the same PC; WorkBuddy supplies its managed Node runtime.
|
|
4
4
|
|
|
5
|
-
## What this
|
|
5
|
+
## What this version adds
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- `qualitySpec` declares important reference elements and their intended independent layer IDs. `strict` mode rejects missing, wrong-type, hidden, or shared layers during preparation. The report explicitly says `declaration_only: true` and `visual_verified: false`: a successful structural check cannot prove that a background image no longer contains the original object.
|
|
8
|
+
- `productionSpec` accepts finished width/height in millimeters and a project-specific minimum effective PPI. Production mode checks the canvas and each visible image at its actual `cover`/`contain` placement, rejects low resolution or mismatched proportions before launching Photoshop, and sets PSD document resolution so the declared physical size is reflected in Photoshop without resampling.
|
|
9
|
+
- The export reads back PSD pixel dimensions, stored resolution, derived physical size, and JPEG preview pixel dimensions. The preview is capped at a 1600-pixel longest side and is for screen review only.
|
|
10
|
+
- Hardware checks now consider currently available RAM and warn when estimated PSD layer data may approach the PSD format's practical size limit. Existing font-substitution and layer-tree reports remain.
|
|
11
|
+
- The WorkBuddy Connector bundle includes a second Skill for reference-image decomposition, visual comparison, and honest editability reporting.
|
|
12
|
+
- `background_diagnostic.jpg` is exported from Photoshop with declared independent foreground layers hidden. It helps reveal old text, objects, and holes still present in the base. Its coverage flag refers only to `qualitySpec` elements the caller declared, and `visual_verified` remains false.
|
|
13
|
+
- `duplicate_audit` optionally compares opaque pixels of independent image layers against one full-canvas image base in the final PSD. A `BAKED_DUPLICATE` warning requires base repair; flat-color matches need human review. `UNVERIFIED_*` reports a bounded or unsupported audit; `NO_EXACT_DUPLICATE_DETECTED` cannot prove a clean base. The auditor uses optional pure-JavaScript `ag-psd` and skips itself if that package is unavailable, without failing PSD/JPEG export.
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
## Limits
|
|
16
|
+
|
|
17
|
+
The connector builds native Photoshop text layers, solid-color rectangles/ellipses, independent PNG/JPEG smart-object image layers, and groups. It does not automatically recover original source layers from a flattened picture. An independent image layer remains pixels internally. Extracting cars, people, signs, and clean backgrounds from a single reference still requires real image-separation and reconstruction work, followed by visual inspection. This release does not export native Illustrator AI or CorelDRAW CDR files.
|
|
10
18
|
|
|
11
19
|
## Requirements
|
|
12
20
|
|
|
13
|
-
- Windows WorkBuddy 5.0+ and
|
|
14
|
-
- Node 20+ when running outside WorkBuddy. WorkBuddy's Connector
|
|
15
|
-
- Enough RAM and disk for the
|
|
16
|
-
- Fonts
|
|
21
|
+
- Windows WorkBuddy 5.0+ and a local Photoshop version accepted by `photoshop_status`. The previous 1.1.1 public connector was exercised on Photoshop 25.0.0 and 26.8.1; this candidate's new production-DPI path has been exercised on 26.8.1. Other versions should be checked on the target PC.
|
|
22
|
+
- Node 20+ only when running the package outside WorkBuddy. WorkBuddy's Connector runtime can provide Node automatically.
|
|
23
|
+
- Enough RAM and disk for the selected canvas. There is no universal hardware minimum. Large files may require a smaller pixel canvas or a future PSB route.
|
|
24
|
+
- Fonts for editable text should be installed on the target PC. Substitutions are reported; text overflow fails rather than silently changing the layout.
|
|
17
25
|
|
|
18
26
|
## MCP workflow
|
|
19
27
|
|
|
20
|
-
1. `photoshop_status` checks the target installation. Optional `progId` selects a
|
|
21
|
-
2.
|
|
22
|
-
3. `get_poster_preparation`
|
|
23
|
-
4. `start_psd_export` creates a durable local Photoshop job
|
|
24
|
-
5. `
|
|
28
|
+
1. `photoshop_status` checks the target installation. Optional `progId` selects a registered Photoshop version.
|
|
29
|
+
2. Build separate text/shape/image/group layers in bottom-to-top order. For reference work, list the required elements and pass `qualitySpec: {mode:'strict',expectedElements:[...]}` to `prepare_workbuddy_poster`. For physical production, also pass `productionSpec: {mode:'production',widthMm,heightMm,minEffectivePpi}`. Use `proof` without a physical-size claim for screen drafts.
|
|
30
|
+
3. Poll `get_poster_preparation` for `draftId`, SHA-256, `quality_report`, and `production_preflight`. A strict error supplies bounded `issues` so multiple missing elements can be corrected in one task.
|
|
31
|
+
4. `start_psd_export` creates a durable local Photoshop job. Poll `get_psd_job` for the PSD/JPEG files, actual PSD and preview dimensions, layer-tree check, quality report, production preflight, background diagnostic, duplicate audit, and warnings.
|
|
32
|
+
5. Inspect the preview and diagnostic against the reference. A `BAKED_DUPLICATE` result needs a repaired base and a new export. Where possible, hide or move key layers in Photoshop to check for old objects or holes in the background. `baseDraftId` plus `edits` revises supported layer properties without reuploading unchanged images; quality and production settings are inherited unless overridden.
|
|
25
33
|
|
|
26
|
-
The
|
|
34
|
+
The optional `prepare_ardot_canvas` and `get_ardot_preparation` route remains available when real Ardot MCP node data and per-node assets exist. It is not required for installation or the direct WorkBuddy workflow.
|
|
27
35
|
|
|
28
36
|
## Storage and recovery
|
|
29
37
|
|
|
30
|
-
Default drafts and final files are under
|
|
31
|
-
|
|
32
|
-
Assets are copied into immutable snapshots. The bridge serializes Photoshop jobs so concurrent requests do not manipulate the same Photoshop instance. After a script timeout, it leaves `photoshop.lock` in the data directory because Photoshop might still be running the script. Close Photoshop and WorkBuddy, remove that lock, then restart. Incomplete drafts are cleared; completed draft caches are pruned after 30 days if no active job uses them. PSD/JPEG deliverables are not pruned.
|
|
33
|
-
|
|
34
|
-
HTTPS image imports are restricted to trusted hosts; local paths and MCP image bytes are supported. For a WorkBuddy generated image, use the local image file path or image data rather than assuming an undocumented remote URL is trusted.
|
|
38
|
+
Default drafts and final files are under the user's `Documents/WorkBuddyLayeredPSD/work` and `Documents/WorkBuddyLayeredPSD/deliveries`. Set absolute `WORKBUDDY_PSD_DATA_DIR` and `WORKBUDDY_PSD_OUTPUT_DIR` to change them. The previous `ZAOJIAN_PSD_DATA_DIR` and `ZAOJIAN_PSD_OUTPUT_DIR` names remain accepted. No publisher-machine path is embedded in the package.
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
Assets are copied into immutable snapshots. Photoshop jobs are serialized. After a script timeout, the bridge retains `photoshop.lock` because Photoshop may still be running; close Photoshop and WorkBuddy, remove the lock from the data directory, and restart. Incomplete drafts are cleared and completed draft caches are pruned after 30 days if no active job uses them. PSD/JPEG deliverables are not pruned.
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
## Distribution status
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
Version 1.1.1 is the published and user-tested baseline. Version 1.2.1 in this workspace is an **unpublished candidate**. Publish the matching npm package before uploading or enabling a WorkBuddy Connector ZIP whose `mcp.json` pins `workbuddy-layered-psd-bridge@1.2.1`. The ZIP contains metadata, `mcp.json`, icon, and the two Skills; the executable package is obtained from npm. The earlier 1.2.0 candidate does not contain this audit and must not be uploaded as 1.2.1.
|
|
41
45
|
|
|
42
|
-
References: [WorkBuddy Connector format](https://open.workbuddy.cn/docs/connector) · [
|
|
46
|
+
References: [WorkBuddy Connector format](https://open.workbuddy.cn/docs/connector) · [Ardot MCP](https://docs.ardot.tencent.com/ardot-mcp/features.html)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "workbuddy-layered-psd-bridge",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Local WorkBuddy MCP bridge from structured poster layers to editable Photoshop PSD",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,5 +19,8 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@modelcontextprotocol/server": "2.4.0",
|
|
21
21
|
"zod": "4.6.7"
|
|
22
|
+
},
|
|
23
|
+
"optionalDependencies": {
|
|
24
|
+
"ag-psd": "34.2.3"
|
|
22
25
|
}
|
|
23
26
|
}
|
package/ps_backend/README.md
CHANGED
|
@@ -4,12 +4,14 @@ This directory is a standalone Windows backend for the `zaojian.psd.manifest.v1`
|
|
|
4
4
|
|
|
5
5
|
## Requirements and compatibility
|
|
6
6
|
|
|
7
|
-
- Windows desktop Photoshop with a registered `Photoshop.Application` COM server. Photoshop 2020 (internal version 21) is the minimum accepted version. The
|
|
7
|
+
- Windows desktop Photoshop with a registered `Photoshop.Application` COM server. Photoshop 2020 (internal version 21) is the minimum accepted version. The earlier 1.1.1 flow was exercised on Photoshop 25.0.0 and 26.8.1; the new production-DPI flow has been exercised on 26.8.1. Other versions must be checked on the installed machine.
|
|
8
8
|
- Node.js 20 or newer and Windows PowerShell 5.1. The WorkBuddy connector package can use its managed Node runtime.
|
|
9
|
-
- Enough memory and disk space for the canvas and source images. The preflight estimates RAM and free space and rejects jobs beyond its limits; Photoshop may require more memory for complex files.
|
|
9
|
+
- Enough memory and disk space for the canvas and source images. The preflight estimates RAM, current available memory, and free space and rejects jobs beyond its limits; Photoshop may require more memory for complex files. Large layer data receives a PSD-size warning because this backend does not yet write PSB.
|
|
10
10
|
- Installed fonts for best fidelity. If a requested font is absent, the backend chooses a local fallback and reports a warning. Text stays editable.
|
|
11
11
|
|
|
12
|
-
The backend rejects unsupported layer styles and malformed manifests before opening Photoshop. It creates editable text layers, vector solid-color shape layers, independent embedded image smart objects, and nested groups. It applies visibility, opacity, and leaf rotation. It saves a layered PSD and then duplicates that same Photoshop document to make the JPEG preview. CMYK documents are supported
|
|
12
|
+
The backend rejects unsupported layer styles and malformed manifests before opening Photoshop. It creates editable text layers, vector solid-color shape layers, independent embedded image smart objects, and nested groups. It applies visibility, opacity, and leaf rotation. It saves a layered PSD and then duplicates that same Photoshop document to make the JPEG preview. CMYK documents are supported and the preview is converted to RGB; the new production-size regression used RGB.
|
|
13
|
+
|
|
14
|
+
Optional `qualitySpec` checks a caller's reference-element-to-layer declaration; it does not analyze pixels inside the images. Optional `productionSpec` checks effective PPI at actual physical size, including `cover`/`contain` scaling, and rejects low-resolution production jobs before Photoshop starts. Production mode sets the document resolution from pixel width and requested millimeters without adding image detail. The result reads back actual PSD pixels/resolution/physical size and JPEG pixels independently.
|
|
13
15
|
|
|
14
16
|
## CLI
|
|
15
17
|
|
|
@@ -18,7 +20,7 @@ node ps_backend/cli.mjs status --json
|
|
|
18
20
|
node ps_backend/cli.mjs build --manifest C:\absolute\work\manifest.json --data-root C:\absolute\work --output-root C:\absolute\deliveries --output-dir C:\absolute\deliveries\job
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
`status` prints one compact JSON line with Photoshop version, platform, architecture, RAM, and a support note. `build` prints one compact JSON line as its last stdout line, with `ok`, PSD and preview absolute paths, Photoshop version, verified layer count/tree, hardware estimate, and warnings. Failures print `{ "ok": false, "code": "...", "error": "..." }` and exit nonzero. `--progid Photoshop.Application.N` can select a separately registered Photoshop version.
|
|
23
|
+
`status` prints one compact JSON line with Photoshop version, platform, architecture, available RAM, and a support note. `build` prints one compact JSON line as its last stdout line, with `ok`, PSD and preview absolute paths, Photoshop version, verified layer count/tree, `quality_report` when declared, `production_preflight`, `psd_dimensions`, `preview_dimensions`, hardware estimate, and warnings. Failures print `{ "ok": false, "code": "...", "error": "..." }` and exit nonzero. `--progid Photoshop.Application.N` can select a separately registered Photoshop version.
|
|
22
24
|
|
|
23
25
|
The manifest and all assets must resolve inside `--data-root`. `--output-dir` must resolve inside the explicitly configured `--output-root`. Both roots may be siblings. Assets are copied into a unique run cache after hash validation so Photoshop reads a stable snapshot. The backend rejects path traversal, symlink escape, mismatched hashes, invalid PNG/JPEG headers, oversized decoded images, unsupported styles, and unavailable output space.
|
|
24
26
|
|
|
@@ -4,6 +4,8 @@ var ZJ_WARNINGS = [];
|
|
|
4
4
|
var ZJ_CREATED = 0;
|
|
5
5
|
var ZJ_DOC = null;
|
|
6
6
|
var ZJ_PREVIEW_DOC = null;
|
|
7
|
+
var ZJ_DIAGNOSTIC_DOC = null;
|
|
8
|
+
var ZJ_CREATED_LAYERS = {};
|
|
7
9
|
|
|
8
10
|
function zjPx(value) { return UnitValue(Number(value), "px"); }
|
|
9
11
|
function zjHex(value) {
|
|
@@ -84,9 +86,25 @@ function zjShape(parent, node) {
|
|
|
84
86
|
layer.name = node.name;
|
|
85
87
|
return layer;
|
|
86
88
|
}
|
|
89
|
+
// FONT_SELECTION_START
|
|
87
90
|
function zjNormalizeFont(value) {
|
|
88
91
|
return String(value || "").toLowerCase().replace(/[\s_\-]/g, "");
|
|
89
92
|
}
|
|
93
|
+
function zjPostScriptFamily(value) {
|
|
94
|
+
var raw = String(value || "");
|
|
95
|
+
var dash = raw.lastIndexOf("-");
|
|
96
|
+
if (dash > 0) {
|
|
97
|
+
var suffix = zjNormalizeFont(raw.substring(dash + 1));
|
|
98
|
+
if (/(bold|heavy|black|demi|regular|roman|italic|oblique|light|thin|medium)/.test(suffix))
|
|
99
|
+
return zjNormalizeFont(raw.substring(0, dash));
|
|
100
|
+
}
|
|
101
|
+
return zjNormalizeFont(raw);
|
|
102
|
+
}
|
|
103
|
+
function zjFontIsBold(font) {
|
|
104
|
+
var style = zjNormalizeFont(font.style);
|
|
105
|
+
var postScript = zjNormalizeFont(font.postScriptName);
|
|
106
|
+
return /(bold|heavy|black|demi)/.test(style) || /(bold|heavy|black|demi)(italic|oblique|mt)?$/.test(postScript);
|
|
107
|
+
}
|
|
90
108
|
function zjSetFont(textItem, textSpec, layerName) {
|
|
91
109
|
var requested = String(textSpec.fontFamily || "");
|
|
92
110
|
var wantBold = Number(textSpec.fontWeight || 400) >= 600;
|
|
@@ -97,15 +115,14 @@ function zjSetFont(textItem, textSpec, layerName) {
|
|
|
97
115
|
var font = app.fonts[i];
|
|
98
116
|
var family = zjNormalizeFont(font.family);
|
|
99
117
|
var postScript = zjNormalizeFont(font.postScriptName);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var isBold =
|
|
118
|
+
var postScriptFamily = zjPostScriptFamily(font.postScriptName);
|
|
119
|
+
if (family != normalized && postScript != normalized && postScriptFamily != normalized) continue;
|
|
120
|
+
var isBold = zjFontIsBold(font);
|
|
103
121
|
if (isBold == wantBold) { best = font; weightMatched = true; break; }
|
|
104
122
|
if (best == null) best = font;
|
|
105
123
|
}
|
|
106
124
|
if (best != null) {
|
|
107
125
|
textItem.font = best.postScriptName;
|
|
108
|
-
if (zjNormalizeFont(best.family) != normalized) ZJ_WARNINGS.push("Font substituted for " + layerName);
|
|
109
126
|
if (!weightMatched) ZJ_WARNINGS.push("Requested font weight unavailable for " + layerName + "; used " + best.postScriptName);
|
|
110
127
|
return;
|
|
111
128
|
}
|
|
@@ -120,6 +137,7 @@ function zjSetFont(textItem, textSpec, layerName) {
|
|
|
120
137
|
}
|
|
121
138
|
throw new Error("No usable font for text layer: " + layerName);
|
|
122
139
|
}
|
|
140
|
+
// FONT_SELECTION_END
|
|
123
141
|
function zjText(parent, node) {
|
|
124
142
|
var layer = parent.artLayers.add();
|
|
125
143
|
layer.kind = LayerKind.TEXT;
|
|
@@ -130,8 +148,8 @@ function zjText(parent, node) {
|
|
|
130
148
|
item.kind = TextType.POINTTEXT;
|
|
131
149
|
var textValue = spec.lines && spec.lines.length ? spec.lines.join("\r") : String(spec.value).replace(/\r\n|\r|\n/g, "\r");
|
|
132
150
|
item.contents = textValue;
|
|
133
|
-
item.size = UnitValue(Number(spec.fontSizePx) * 72 / JOB.
|
|
134
|
-
item.leading = UnitValue(Number(spec.lineHeightPx || spec.fontSizePx * 1.2) * 72 / JOB.
|
|
151
|
+
item.size = UnitValue(Number(spec.fontSizePx) * 72 / JOB.documentDpi, "pt");
|
|
152
|
+
item.leading = UnitValue(Number(spec.lineHeightPx || spec.fontSizePx * 1.2) * 72 / JOB.documentDpi, "pt");
|
|
135
153
|
zjSetFont(item, spec, node.name);
|
|
136
154
|
item.color = zjHex(spec.color);
|
|
137
155
|
if (spec.align == "center") item.justification = Justification.CENTER;
|
|
@@ -222,16 +240,51 @@ function zjBuildNode(parent, node) {
|
|
|
222
240
|
if (node.opacity != null) layer.opacity = Math.max(0,Math.min(100,Number(node.opacity)*100));
|
|
223
241
|
if (node.rotation && node.type != "group") layer.rotate(Number(node.rotation), AnchorPosition.MIDDLECENTER);
|
|
224
242
|
if (node.visible === false) layer.visible = false;
|
|
243
|
+
ZJ_CREATED_LAYERS["L:" + String(node.id)] = layer;
|
|
225
244
|
ZJ_CREATED++;
|
|
226
245
|
return layer;
|
|
227
246
|
}
|
|
247
|
+
function zjSaveBackgroundDiagnostic() {
|
|
248
|
+
if (!JOB.backgroundDiagnosticPath || !JOB.backgroundDiagnosticLayerIds ||
|
|
249
|
+
JOB.backgroundDiagnosticLayerIds.length === 0) return;
|
|
250
|
+
var changed = [];
|
|
251
|
+
try {
|
|
252
|
+
for (var i = 0; i < JOB.backgroundDiagnosticLayerIds.length; i++) {
|
|
253
|
+
var id = String(JOB.backgroundDiagnosticLayerIds[i]);
|
|
254
|
+
var layer = ZJ_CREATED_LAYERS["L:" + id];
|
|
255
|
+
if (!layer || layer.typename == "LayerSet")
|
|
256
|
+
throw new Error("Diagnostic target missing or not a leaf layer: " + id);
|
|
257
|
+
if (!layer.visible) throw new Error("Diagnostic target already hidden: " + id);
|
|
258
|
+
layer.visible = false;
|
|
259
|
+
changed.push(layer);
|
|
260
|
+
}
|
|
261
|
+
ZJ_DIAGNOSTIC_DOC = ZJ_DOC.duplicate("Zaojian background diagnostic", false);
|
|
262
|
+
ZJ_DIAGNOSTIC_DOC.flatten();
|
|
263
|
+
if (ZJ_DIAGNOSTIC_DOC.mode != DocumentMode.RGB)
|
|
264
|
+
ZJ_DIAGNOSTIC_DOC.changeMode(ChangeMode.RGB);
|
|
265
|
+
var maxSide = Math.max(ZJ_DIAGNOSTIC_DOC.width.as("px"), ZJ_DIAGNOSTIC_DOC.height.as("px"));
|
|
266
|
+
if (maxSide > 1200) {
|
|
267
|
+
var ratio = 1200 / maxSide;
|
|
268
|
+
ZJ_DIAGNOSTIC_DOC.resizeImage(zjPx(ZJ_DIAGNOSTIC_DOC.width.as("px") * ratio),
|
|
269
|
+
zjPx(ZJ_DIAGNOSTIC_DOC.height.as("px") * ratio), null, ResampleMethod.BICUBIC);
|
|
270
|
+
}
|
|
271
|
+
var jpgOptions = new JPEGSaveOptions();
|
|
272
|
+
jpgOptions.quality = 8;
|
|
273
|
+
jpgOptions.embedColorProfile = true;
|
|
274
|
+
ZJ_DIAGNOSTIC_DOC.saveAs(new File(JOB.backgroundDiagnosticPath), jpgOptions, true, Extension.LOWERCASE);
|
|
275
|
+
} finally {
|
|
276
|
+
try { if (ZJ_DIAGNOSTIC_DOC) ZJ_DIAGNOSTIC_DOC.close(SaveOptions.DONOTSAVECHANGES); } catch (ignoreDiagnostic) {}
|
|
277
|
+
ZJ_DIAGNOSTIC_DOC = null;
|
|
278
|
+
for (var j = changed.length - 1; j >= 0; j--) changed[j].visible = true;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
228
281
|
function zjBuild() {
|
|
229
282
|
var originalDialogs = app.displayDialogs;
|
|
230
283
|
var originalDoc = app.documents.length ? app.activeDocument : null;
|
|
231
284
|
try {
|
|
232
285
|
app.displayDialogs = DialogModes.NO;
|
|
233
286
|
var mode = JOB.canvas.colorMode == "CMYK" ? NewDocumentMode.CMYK : NewDocumentMode.RGB;
|
|
234
|
-
ZJ_DOC = app.documents.add(zjPx(JOB.canvas.widthPx),zjPx(JOB.canvas.heightPx),Number(JOB.
|
|
287
|
+
ZJ_DOC = app.documents.add(zjPx(JOB.canvas.widthPx),zjPx(JOB.canvas.heightPx),Number(JOB.documentDpi),
|
|
235
288
|
String(JOB.canvas.name),mode,DocumentFill.WHITE);
|
|
236
289
|
for (var i = 0; i < JOB.layers.length; i++) zjBuildNode(ZJ_DOC,JOB.layers[i]);
|
|
237
290
|
zjWriteLayerReport();
|
|
@@ -254,12 +307,19 @@ function zjBuild() {
|
|
|
254
307
|
ZJ_PREVIEW_DOC.saveAs(new File(JOB.previewPath),jpgOptions,true,Extension.LOWERCASE);
|
|
255
308
|
ZJ_PREVIEW_DOC.close(SaveOptions.DONOTSAVECHANGES);
|
|
256
309
|
ZJ_PREVIEW_DOC = null;
|
|
310
|
+
try {
|
|
311
|
+
zjSaveBackgroundDiagnostic();
|
|
312
|
+
} catch (diagnosticError) {
|
|
313
|
+
ZJ_WARNINGS.push("BACKGROUND_DIAGNOSTIC_FAILED: " +
|
|
314
|
+
String(diagnosticError.message || diagnosticError));
|
|
315
|
+
}
|
|
257
316
|
ZJ_DOC.close(SaveOptions.DONOTSAVECHANGES);
|
|
258
317
|
ZJ_DOC = null;
|
|
259
318
|
if (originalDoc) app.activeDocument = originalDoc;
|
|
260
319
|
zjStatus("OK", "PSD and preview saved");
|
|
261
320
|
} catch (error) {
|
|
262
321
|
try { if (ZJ_PREVIEW_DOC) ZJ_PREVIEW_DOC.close(SaveOptions.DONOTSAVECHANGES); } catch (ignorePreview) {}
|
|
322
|
+
try { if (ZJ_DIAGNOSTIC_DOC) ZJ_DIAGNOSTIC_DOC.close(SaveOptions.DONOTSAVECHANGES); } catch (ignoreDiagnostic) {}
|
|
263
323
|
try { if (ZJ_DOC) ZJ_DOC.close(SaveOptions.DONOTSAVECHANGES); } catch (ignoreDocument) {}
|
|
264
324
|
try { if (originalDoc) app.activeDocument = originalDoc; } catch (ignoreRestore) {}
|
|
265
325
|
zjStatus("ERROR", String(error.message || error) + " at line " + String(error.line || "?"));
|