From d95acfaf170baf5460ef79fac1f808aa19b878de Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 27 May 2026 09:14:08 -0400 Subject: [PATCH] TODO: queue one-click JPEG export via direct canvas rasterizer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- TODO.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/TODO.md b/TODO.md index 8214036..66c51c7 100644 --- a/TODO.md +++ b/TODO.md @@ -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