Four cover layouts 是做什么的?
Create a vertical short-video cover (default 1086×1448, 3:4, opaque PNG) from a person photo. The four structures are: four-corner composition, overlay composition, L-shaped composition, and left-right layout. Always run the scripts; do not eyeball text placement.
Detailed geometry, text effects, and character-splitting rules are in references/layouts.md and references/locked-params.md. Hook writing is in references/hook-writing.md. Gray block diagrams are in assets/diagram-*.png. examples/ use synthetic figures and default cover text from the tutorial for smoke testing; do not use real photos or the caller's own copy.
Inputs
Required:
- One person photo
- Layout keyword:
four-corner composition/four-corner/sijiao,overlay composition/overlay/dieya,L-shaped composition/L-shaped/left-right layout/left-right/zuoyou
Copy is handled per the decision tree below. Optional:
- Existing cutout mask (
--mask) - Video transcript / topic notes (to extract a hook; can also suggest a layout if none specified)
--polaroid(default off). The output size is still the 3:4 cover itself; do not add English handwritten phrases on the frame, nor tutorial red numbers or bottom red bar
Decision Tree
- Layout already chosen, with locked copy from caller → Do not change a single character; only allow line breaks or hyphenation by typographic unit. Go to step 5.
- Layout already chosen, but no copy provided → Use the default text from that layout's tutorial cover (see table below); do not substitute with the caller's previous video copy. Go to step 5.
- Copy not locked, but a transcript or topic is available → Run
scripts/extract_hook.py. Use thehook/subtitle/suggested_layoutfrom its output (if heuristics are poor, re-run using the same output'sllm_prompt; do not call a paid API). Do not fabricate numbers or results not present in the material. Do not dump a content summary onto the cover. - Layout still not chosen → Follow the suggestion: 4 units with no subtitle → four-corner; a pair of main/sub heading → overlay; longer sentences → L-shaped (or left-right).
- Cutout → Run
scripts/cutout.py(or letrender_cover.pycall it automatically). Prefer rembgbirefnet-portrait; fall back to rembg default model if unavailable. Cache the mask next to the source image or in--work-dir. - Render → Run
scripts/render_cover.pywith the photo, layout, and either locked copy or default tutorial text. If--titleis omitted, the script automatically fills in that layout's default cover text. - Review → Open the 270px-wide thumbnail written by the script, and check each item on the QA list below. Do not overwrite existing files; append
_v2,_v3etc. on name collision.
Default Tutorial Cover Text
Used when no copy is provided. These words come from the four tutorial covers themselves; they are not the caller's hook.
| Layout | Main Title | Subtitle |
|---|---|---|
| Four-corner composition | 四角构图 (one character per corner: 四 / 角 / 构 / 图) | (none) |
| Overlay composition | 叠压构图 | 叠压构图技巧 |
| L-shaped composition | 「型构图 (left vertical column) | 结构法 (bottom bar) |
| Left-right layout | 左右式排版 (left vertical column) | 结构技巧方法 (annotated vertical column) |
If the caller has locked the copy, typeset exactly as given; do not revert to the table above.
Cutout
python scripts/cutout.py --image PHOTO.png
python scripts/cutout.py --image PHOTO.png --output work/mask.png --model birefnet-portrait
Rules:
- Subject becomes a sticker layer: use a uniform white stroke of 32px on the 1086×1448 canvas; no drop shadow outside the white edge.
- Do not beautify, alter facial features, or adjust subject color/brightness. Only shrink the subject; never upscale the bitmap (allow up to 1.5% fill error).
- Four-corner, overlay: background is the original photo covering the canvas; align the cutout with the background, both on the same subject. If the close-up head touches the top, shift the original + sticker downward to reveal wall space above for the title.
- L-shaped, left-right: fill the right side / half with the subject, shrink only, no upscaling; allow cropping. The text side of the background can be darkened or blurred, and the in-place face from the background must be masked out to avoid a second blurry face. Still, do not change the subject's color.
Four Structures (Summary)
Full rules in references/layouts.md; locked dimensions in references/locked-params.md.
- Four-corner composition: Subject enlarged and centered; four short units placed in the four corners. Ideal use is 4 Chinese characters, one per corner (default:
四/角/构/图). If not 4 units, distribute evenly across TL/TR/BL/BR, no rewriting. Single-character corner visual height ~16% H. - Overlay composition: Background → large main title (under the subject layer, with lower part of glyphs can go behind the head/shoulders, but at least ~70% area visible) → subject sticker → subtitle (topmost, horizontally across the torso, not the face). Requires a main title + shorter subtitle. Default:
叠压构图+叠压构图技巧. - L-shaped composition: Text arranged in a 「 / L shape (left vertical column + bottom horizontal bar); subject fills the right opening. If there is a subtitle, vertical = main title, bottom bar = subtitle. Default: vertical
「型构图, bottom bar结构法. - Left-right layout: 50/50 split; subject fills the right half; main title in left vertical column; optional smaller vertical subtitle to the lower-middle right of the main title, still on the left half. Default:
左右式排版+结构技巧方法.
Hook Extraction
python scripts/extract_hook.py --transcript talk.txt --topic "Topic notes"
python scripts/extract_hook.py --title "Four-corner composition" --layout four-corner composition
python scripts/extract_hook.py --layout overlay composition
python scripts/extract_hook.py --transcript talk.txt --print-prompt
Choose only one core hook; keep it colloquial and concrete. Do not fabricate. Subtitle can be empty. If no copy or transcript provided, output the default tutorial cover text for that layout. Output JSON includes hook, subtitle, suggested_layout, rationale, and line-break schemes for all four layouts. See references/hook-writing.md for details.
Fonts and Glyph Style
Main title in yellow #FEDD00, subtitle in white #FFFFFF. Both yellow and white use the same effect:
- Pure bottom-right hard shadow; not a uniform stroke around the glyph. The top and left edges of the glyph are filler directly against the background (only anti-aliasing); black comes from a copy of the same glyph shifted down and right behind it.
- Shadow color
#000000, opaque, zero blur. - Offset:
ox = oy = max(2, round(font_size * 0.047)). For typical large titles, ~15 px. - Do not use PIL
stroke_widthto give the title a uniform black stroke.
Use a very heavy sans-serif / title blackface; search in the following order (use the first found; script automatically checks fonts/ and common directories):
- Unbounded Sans (included in this repo as
fonts/UnboundedSans.ttf, SIL OFL 1.1) - YouSheBiaoTiHei (only if the caller has a local licensed copy)
- Source Han Sans / Noto Sans CJK Black (e.g., NotoSansSC-Black)
- Source Han Sans Black
- Microsoft YaHei Bold (msyhbd.ttc)
- Xinqingnian Ti
- Noto Sans CJK (Bold / system font)
- DejaVu (last resort; may be missing CJK characters)
You may place other fonts in fonts/ or set COVER_FONTS_DIR / COVER_FONT. The unbounded sans bundled with this repo is redistributed under SIL OFL 1.1; see fonts/OFL.txt. For other commercial fonts, please provide your own licensed copy; this skill does not grant redistribution rights for them. If glyphs are missing, the script falls back through the list; still, do not rewrite the copy.
Safety Zone and Subject
- Safety zone: left/right ≥8%, top/bottom ≥7%. Text (including hard shadow) must lie within the zone.
- Do not cover the face (hairline to chin). Overlay subtitle may cover the torso. Overlay main title sits behind the subject; partial occlusion by the head/shoulders is intentional, but at least ~70% of each character's upper part must be discernible; nothing may be completely hidden.
- Subject scaling factor must be ≤ ~1.0 (allow 1.5% fill error to avoid seams from a 1080-wide image on a 1086 canvas).
- Do not output tutorial decorations: red numbers, bottom red bar, Polaroid English handwritten phrase.
Render Commands
When --title is not provided, use the default tutorial cover text from the table above. The commands below explicitly state the defaults for reference:
python scripts/render_cover.py --image PHOTO.png --layout four-corner composition --title 四角构图 --output out.png
python scripts/render_cover.py --image PHOTO.png --layout overlay composition --title 叠压构图 --subtitle 叠压构图技巧 --output out.png
python scripts/render_cover.py --image PHOTO.png --layout L-shaped composition --title 「型构图 --subtitle 结构法 --output out.png
python scripts/render_cover.py --image PHOTO.png --layout left-right layout --title 左右式排版 --subtitle 结构技巧方法 --output out.png
Common parameters: --subtitle, --mask, --polaroid (default off), --work-dir, --font. If the caller has locked the copy, replace --title/--subtitle with that exact text; do not modify it.
Each successful render also writes next to the output:
<stem>_thumbnail_check_270px.png<stem>_production_notes.md
If a target file already exists, automatically append _v2, _v3, etc.; do not overwrite. Do not overwrite existing cover files in the caller's video asset directory.
QA Checklist
After rendering, check both the 270px thumbnail and full resolution:
- Every character is readable at a glance on the thumbnail
- Glyphs exactly match the locked copy (or confirmed default tutorial text); no extra, missing, or altered characters
- Text effect is a bottom-right hard shadow: top/left edges are filler directly against background, not a uniform black stroke; shadow has no blur
- Yellow is
#FEDD00, white is#FFFFFF - Subject white stroke is ~32 px uniform; no soft drop shadow outside the white edge
- Text is inside the safety zone; no face coverage (overlay subtitle only covers torso; overlay main title has at least ~70% visible)
- Overlay layer order is correct: main title behind subject, subtitle on top
- The structure (four-corner, L-shaped, left-right) is immediately recognizable
- Subject is only shrunk, not upscaled (within 1.5% fill error); no beautification, no color adjustment
- No tutorial decorations (red numbers, bottom red bar, Polaroid English); no extra ad copy
- Output is a 1086×1448 opaque PNG; old file remains untouched
If any item fails, adjust parameters and render a new version (new filename); do not manually edit the output.