feat(cli): add --output-resolution to lambda render#1020
Conversation
miguel-heygen
left a comment
There was a problem hiding this comment.
Clean, well-scoped addition. Threading outputResolution through the existing normalizeResolutionFlag from core avoids duplicating the alias table, and wiring it into both render and render-batch covers the two code paths. The types line up end-to-end: CanvasResolution -> RenderArgs / RenderBatchArgs -> SerializableDistributedRenderConfig -> DistributedRenderConfig (which the producer already handles).
Two minor nits, neither blocking:
-
Unnecessary lint suppression —
fallow-ignore-next-line complexityonparseOutputResolutionis overkill for a 7-line function with two branches. The rest of the file uses it on genuinely complex functions (100+ line handlers). Not worth a re-push, just worth knowing. -
Error message alias list is incomplete — The
throwmentions1080p-portrait, 4k-portrait, 1080p-square, 4k-squarebut the core alias table also acceptsportrait-1080pandsquare-1080p. Again, minor — users hitting this error get pointed at the canonical names anyway.
CI: the File size check failure is pre-existing (BlocksTab.tsx, NLELayout.tsx) and unrelated to this PR.
c1fd891 to
f3b9b1f
Compare
|
Thanks Miguel — both nits addressed in the latest push:
Re: the pre-existing |
vanceingalls
left a comment
There was a problem hiding this comment.
No blockers. Clean CLI extension pattern — delegates parsing to normalizeResolutionFlag, threads through SerializableDistributedRenderConfig.outputResolution, wires both lambda render and render-batch correctly.
Nits
parseOutputResolution's error message listsportrait-1080pandsquare-1080pas valid aliases. Verify those are actually accepted bynormalizeResolutionFlag. If the alias table doesn't include them, the error text is misleading.- Help text shows
--width 1920 --height 1080 --output-resolution 4ktogether — confirm whether--width/--heightare still required when--output-resolutionis passed (the supersampling scenario the PR targets), or can be omitted.
The pre-existing File size check failure on BlocksTab.tsx/NLELayout.tsx is unrelated to this PR.
— Vai
Allows authored-at-1080p compositions to render at 4K/2K via Chrome deviceScaleFactor supersampling without re-laying-out the composition. Plain --width 3840 silently lays out at 1920×1080 because data-width/ data-height attrs override Config.width — this flag is the supported way to ask the renderer to supersample. Accepts canonical CanvasResolution names (landscape, landscape-4k, portrait, portrait-4k, square, square-4k) and aliases (1080p, 4k, uhd, hd, 1080p-portrait, 4k-portrait, 1080p-square, 4k-square). Wired through render + render-batch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
f3b9b1f to
1bca6ec
Compare

What
Add
--output-resolutiontohyperframes lambda render(andrender-batch). Renders an authored-at-1080p composition at 4K/2K via ChromedeviceScaleFactorsupersampling without changing the composition layout.Why
Plain
--width 3840 --height 2160against a composition withdata-width="1920"silently produces a 1080p output because the runtime lays out the page at the composition's authored dimensions — Config.width is effectively ignored. There was no supported way through the CLI to render at a higher resolution than the composition was authored at.The new flag is the supported supersampling path: composition lays out at its authored canvas size and Chrome supersamples to the target preset. PR #1022 (next in stack) adds a warning when the user passes mismatched
--width/--heightand points them here.How
CanvasResolutionnames (landscape,landscape-4k,portrait,portrait-4k,square,square-4k) and the aliases the localhyperframes renderalready accepts (1080p,4k,uhd,hd,1080p-portrait,4k-portrait,1080p-square,4k-square).normalizeResolutionFlagexported from@hyperframes/core— same alias table the local renderer uses, no duplication.SerializableDistributedRenderConfig.outputResolution(already supported by the SDK + producer); no SDK or runtime changes.lambda renderandlambda render-batchso batch personalisation flows can also target 4K.Test plan
bun run --cwd packages/cli dev lambda render … --output-resolution bogusrejects with the canonical-names list--output-resolution 4kon a 1080p composition produces a 4K output (verified end-to-end on inspector-launch — 196 MB vs the 77 MB 1080p output)parseOutputResolution— delegated to existingnormalizeResolutionFlagcoverage in core