"To show the artist's canvas in a second window, you have to read the pixels — without flattening, merging, or touching the document they're still working in."
The Deceptively Simple Task
Cinder needs a live picture of what's on the Photoshop canvas. That sounds trivial — just grab the image. But the document is the artist's active work, full of layers, mid-edit. A naive 'grab the image' that flattens or merges layers would mutate the very thing the artist is drawing. The real task is: read a composite snapshot of the canvas without changing the document at all.
The Right Tool: A Read-Only Imaging Path
The plugin platform provides an imaging API that returns the document's composited pixels — all visible layers merged into one image — as a read, without mutating the document. The document keeps all its layers; you just receive a flattened view of them. This is the difference between asking 'what does this look like right now?' (a read) and 'flatten this document' (a destructive mutation). Same visual result, completely different consequence for the artist's file.
Ask for a Smaller Image on Purpose
The capture asks for a target size — a downscaled preview, not the full-resolution canvas. This isn't just bandwidth thrift. Requesting a smaller target lets the platform serve a pre-downscaled level from its internal image pyramid, which is dramatically faster than reading and shrinking the full image every time. For a live preview that updates as the artist works, fast-and-small beats perfect-and-slow. The right size for the job is the smallest size that serves the purpose.
The Mandatory Cleanup
There's a sharp edge: the captured image data holds host-application memory, and it must be explicitly released after each capture. Skip the release and, on a live preview that captures repeatedly, the plugin steadily leaks memory until the host warns that the plugin is over its limit. The capture isn't done when you have the bytes — it's done when you've also handed the memory back. Every capture is acquire-use-release, and the release is not optional.