Crop & Resize: Add Borders to a fixed canvas, in a chosen colour (#86) - #104
Open
StuartCameronCode wants to merge 1 commit into
Open
StuartCameronCode wants to merge 1 commit into
StuartCameronCode wants to merge 1 commit into
Conversation
Adds a Borders section to Crop & Resize: pad the picture out to a fixed canvas (PAL/NTSC DVD, 720p, 1080p presets, or an exact size in advanced mode) without rescaling it, independent of Resize, with a black/grey/ white/custom fill colour. All padding, including the existing Pad to Fill, now happens in one BORDERS step at the very end of both templates, after grain and the output format conversion, so nothing touches the bars. The fill is converted into the clip's own format via resize with the source's matrix and range, which also fixes Pad to Fill's bars: AddBorders' default fill is luma 0, below video black on limited-range sources. Offsets stay on the chroma grid, and on the field grid when the picture is still interlaced; a picture larger than the canvas raises rather than producing the wrong frame size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014GLXdGLfPwgYjW1AkonGqN
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 #86.
What users get
A new Borders section in Crop & Resize:
#RRGGBB, also used by the existing Pad to Fill.sinceAppVersion: 1.2.0.How
{{#BORDERS}}step at the very end of both templates, after grain and afterCHROMA_CONVERT, so nothing noises or resamples the bars. Pad to Fill's block now only records its box and uses the same step._border_color()converts the chosen RGB into the clip's own format viaresizewith the source's matrix/range (ColorMetadata::zimg_matrix/is_full_range).AddBorderswith nocolor=fills luma 0 — below video black on limited range. Pad to Fill's bars were therefore "blacker than black"; they are now 16 (8-bit) / 64 (10-bit).Tests
test_156–test_160(canvas, bars-last ordering, matrix/range, field alignment, Pad to Fill sharing the step).integration_borders_test.dart— bar levels at 8-bit 4:2:0 and 10-bit 4:2:2, custom white = 940 at 10-bit, interior bit-identical positioning, oversize error, preview.color=makes the heavy tests fail (luma 0 vs 16/64/940).cargo testgreen apart from the whisper test (add-on not installed);flutter test --exclude-tags heavygreen; heavy aspect/upscale/borders suites green.Found along the way, not fixed here
-colorspace bt709etc. is stamped on the untagged Y4M pipe — every tagged encode is colour-shifted.clapcrop (720→702) and the decoder's-s 720x576rescales it back.Both are being handled on separate branches.
🤖 Generated with Claude Code
https://claude.ai/code/session_014GLXdGLfPwgYjW1AkonGqN