Affinity Export Output
The node that actually writes your image out to the Affinity asset path
- images
- written_paths_json
- primary_path
- summary_json
Every host bridge in MKRShift Nodes follows the same two-step shape: a plan node that decides where and how the result should land in the host app, and a runtime node that actually performs the write. Affinity Export Output is the runtime half of the Affinity lane. Feed it your generated image plus an affinity_export_plan_json (from MKRAffinityExportPlan), and it writes the image file to the disk path the plan specifies - the path that your Affinity addon then picks up to place as a layer in your document.
It looks deceptively simple, because under the hood it shares a base class with every other host output node in the pack. That's the point: the whole addon lane was built so "write result to a path a host addon will consume" is one consistent behavior, and only the plan schema differs per app.
How it works
The node reads the plan JSON and pulls out the target asset_path (it also understands a nested asset object with a path). Then it saves your image batch there with PIL. A few details worth knowing:
- If the path has no recognized image suffix (or is missing one entirely), it writes PNG and adds a warning - so a typo'd
.affphotopath won't silently produce a corrupt file. - A batch of images becomes
stem_0000.png,stem_0001.png, … on the same base path. - The directory is created on the fly, so a missing folder isn't an error.
filename_overridetakes precedence over the plan's asset path if you want to redirect a single run without editing the plan.
The outputs tell you exactly what happened: written_paths_json lists every file written, primary_path is the first one (or the sole one, for a single image), and summary_json has the host name, target layer name, count, and warnings.
Installation
cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes
Restart ComfyUI, or install via ComfyUI Manager ("MKRShift Nodes"). No pip dependencies - this is PIL file writing plus JSON.
Common issues
The biggest misunderstanding is expecting this node to touch Affinity itself. It doesn't - it writes a file to a path. The Affinity addon (in addons/affinity/) watches that path and does the actual document placement. If nothing appears in your document, check the addon, not this node. Second, remember it needs a plan: wiring raw images into the plan input does nothing, and wiring no plan means the default empty {} yields no asset path, so the fallback filename mkrshift_output.png gets written to the current working directory - usually not where you think it is. Always run MKRAffinityExportPlan first and wire its JSON through. And the batch naming (zero-padded indexes) means a re-run overwrites the same names - fine for iteration, but if you're preserving versions, set filename_override or plan paths that include a run number. For a single generated frame this is one of the simplest "get it out of ComfyUI and into the DCC" nodes in the pack.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| affinity_export_plan_json | STRING | {} | — |
| filename_overrideopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| written_paths_json | STRING | — |
| primary_path | STRING | — |
| summary_json | STRING | — |