Flow builder: aspect-ratio-aware display + visual crop (#668) - #700
Open
mcarlson wants to merge 6 commits into
Open
Flow builder: aspect-ratio-aware display + visual crop (#668)#700mcarlson wants to merge 6 commits into
mcarlson wants to merge 6 commits into
Conversation
Deploying frontend-alpha with
|
| Latest commit: |
1e43174
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1a85599e.frontend-btm.pages.dev |
| Branch Preview URL: | https://feat-flow-aspect-ratio-crop.frontend-btm.pages.dev |
Deploying frontend-stage with
|
| Latest commit: |
1e43174
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6c9d91d9.frontend-d7v.pages.dev |
| Branch Preview URL: | https://feat-flow-aspect-ratio-crop.frontend-d7v.pages.dev |
Center-crop geometry, aspect-locked clamp, pixel conversion, preset/size mapping, and a cache signature for the flow aspect-ratio crop feature. 23 unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add globalAspectRatio (auto|preset) with setGlobalAspectRatio that re-fits every keyframe crop in the same set(). Add setKeyframeDimensions (seeds a center crop on image load) and setKeyframeCrop (persists an editor selection and invalidates the reupload cache). Extend FlowKeyframe with naturalWidth/ Height, crop, and croppedDreamUuid/Signature. Persist the new fields for settled keyframes only; bump store to v5 with a migration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Before generating each transition, crop both keyframes client-side to the flow's output ratio (canvas), re-upload as image Dreams, and feed those UUIDs to the i2v job — with a per-keyframe signature cache so unchanged crops don't re-upload. Pass a matching size string so wan-i2v stops hard-coding 16:9. Crop/upload failures fall back to the original image (Bugsnag-logged) so a CORS/network hiccup degrades gracefully. Full-frame crops (source already matches) skip the reupload. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Keyframe cards size to the output ratio and render each frame's stored crop, so the strip shows the real shape (no more hidden portrait/landscape). - Capture natural dimensions on image load to seed a default center crop. - Output aspect-ratio selector (auto + presets) in the settings panel; auto shows the ratio it resolves to. - Visual crop editor modal: aspect-locked frame, drag to reposition, slider to zoom, rule-of-thirds grid, reset-to-center. Saves a normalized crop region. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Auto output ratio now derives from the MAJORITY keyframe shape (not the first frame), so frames that already match are left untouched and only the odd-aspect image(s) get cropped. Crops are derived (userCrop ?? centerCrop) rather than eagerly seeded, so a majority shift or ratio override just recomputes; explicit overrides clear stale user crops. Cropped frames get a 'cropped' badge in the strip so the oddball is obvious. majorityPresetRatio + resolveFlowRatio added with tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mcarlson
force-pushed
the
feat/flow-aspect-ratio-crop
branch
from
July 30, 2026 14:15
62d3c2c to
2188aa5
Compare
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Fixes #668 — the studio flow builder rendered every keyframe in a fixed 140×100
object-fit: coverbox, hiding each image's true aspect ratio. A stray portrait image slipped through unnoticed and the generated video came out distorted.Per the issue thread (crop to match the video output) the flow now commits to a single output shape and crops keyframes to it — a transition clip can't morph between two shapes, so one shape is required.
🎥 Demo (local, against staging)
https://drive.google.com/file/d/1G26joyxWXjn7Qnp-8n_wdBi0lB91w5aC/view?usp=sharing
How it works
autooutput ratio is the most common keyframe shape. Frames that already match are left untouched — only the odd-aspect image(s) get cropped, flagged with aCROPPEDbadge in the strip.Auto (…)+16:9 / 9:16 / 1:1 / 4:3 / 3:4override in the settings panel.(sourceDream, crop, ratio)signature so unchanged crops don't re-upload; full-frame (already-matching) frames skip re-upload; crop/upload failures fall back to the original image (Bugsnag-logged).Crops are derived (
userCrop ?? centerCrop(for majority ratio)), so a majority shift or ratio override just recomputes — no stale state.Scope notes
flow.storebumped to v5 with a migration (defaultsglobalAspectRatio: "auto"); new per-keyframe fields persisted only for settled keyframes.Testing
tsc --noEmitand ESLint clean.claude --resume bacf1207-b5e8-4df3-a36d-89b69e54bc91