TODO: queue one-click JPEG export via direct canvas rasterizer

Current JPEG flow makes the user save a PDF, then re-pick it from
disk for PDF.js to convert. We can't cache the PDF in between
because window.print() doesn't expose the generated bytes to JS.

Log the proper fix: write a direct canvas rasterizer that walks
the layer model (image / text / shape / color / qr / pixelart),
draws each layer onto an off-screen canvas at the artboard's design
dims, then toBlob('image/jpeg'). Same approach the pixel-art PNG
export already uses, generalised across all layer types. CORS-
tainted remote images fall back to the existing PDF round-trip,
with a toast explaining why. ~300–500 LoC, no new dep.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.7 committed 2026-05-27 09:14:08 -04:00
1 parent 1c6a239f5a
commit d95acfaf17
1 file changed
+16
+16
View File
@@ -22,6 +22,22 @@ Running list of deferred work. Detailed specs for the larger items live in
flow currently renders the selected-layer dashed outline in the
output. Add `body.exporting` (or similar) state that strips
selection chrome before the raster snapshot.
- **One-click JPEG export (skip the PDF round-trip).** Today the
flow is: print → user saves PDF → user re-picks PDF → PDF.js
converts to JPEG. We can't cache the PDF in between — `window
.print()` doesn't expose the generated bytes to JS. Instead,
write a direct canvas rasterizer that walks the layer model
(image / text / shape / color / qr / pixelart) and draws each
layer onto an off-screen canvas at the artboard's design dims,
then `toBlob('image/jpeg')`. Same approach the pixel-art PNG
export already uses, generalised. CORS-tainted remote images
(cross-origin host without `Access-Control-Allow-Origin`) would
break the direct path — fall back to the existing PDF round-trip
for those with a one-line "this image needs the PDF route" toast.
Most modern image hosts (CDNs, Blossom blobs) send CORS so the
fallback should be rare. ~300–500 LoC of layer-by-layer drawing
code; reuses `renderShapeIntoElement` etc. as references for
geometry but writes to canvas instead of DOM.
- **Independent-axis corner-node resize.** Corner resize handles
currently lock the aspect ratio (or scale both axes together).
Behaviour should follow the actual drag vector: dragging mostly