feat(render): user-positioned background images (zoom + focal point) - #82
Merged
Conversation
Background images were fixed center-crops (preserveAspectRatio slice) — users could not choose which part of a photo shows or how zoomed it is. - New slide-or-brand fields: bg_image_scale (0.1–5, default 1), bg_image_x / bg_image_y (0–1 focal point, default 0.5) - text.rs: image_to_data_uri_with_size reports intrinsic dimensions (header decode, no full decode) for both local and remote images - template.rs: bg_image_geom computes cover-fit × user scale placed by the focal point; defaults reproduce the old center-crop exactly (backward compatible — templates without the fields are unchanged) - blog-hero migrates to the geometry approach; other bg_image templates keep slice until needed - tests: resvg spike (none + overflow clipping + focal shift), geometry unit math, blog-hero integration render, image dimension decode; image crate added (already in the tree via resvg)
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
5 tasks
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.
Closes the positioning half of #74 follow-ups (mobile needs it for the background editor).
What
bg_image_scale(0.1–5, default 1),bg_image_x/bg_image_y(0–1 focal point, default 0.5)bg_image_geom: cover-fit × user zoom, placed by focal point, values clamped; defaults reproduce the oldslicecenter-crop exactly (verified pixel-identical semantics)preserveAspectRatio="none"+ computed x/y/w/h); other bg_image templates keep slice until migratedimage_to_data_uri_with_sizereports intrinsic dimensions (header decode only) for local and remote images;imagecrate added as a direct dep (already in the tree via resvg)Why
CLI/server users can now pick which part of a background photo shows (e.g.
bg_image_x: 0.0for a subject on the left), and the mobile background editor (cosy-mobile) drives these same fields from a pinch/drag UI.Testing