Polish README preview framing
This commit is contained in:
parent
5f2a644906
commit
f89d6ed49d
4 changed files with 24 additions and 8 deletions
11
README.md
11
README.md
|
|
@ -7,8 +7,8 @@ look locally pixelated but fall apart the second you ask them to commit to one
|
|||
lattice like grown-ups.
|
||||
|
||||
Instead of pretending this is a resize problem, Repixelizer treats it as
|
||||
lattice inference plus `phase-field` reconstruction: infer the ruler, scout the
|
||||
edges, let every output cell search a tiny local window for quieter paint,
|
||||
lattice inference plus `phase-field` reconstruction: infer the ruler, preview
|
||||
the edges, let every output cell search a tiny local window for quieter paint,
|
||||
relax the whole sheet back into a coherent lattice, then sample once and go
|
||||
home.
|
||||
|
||||
|
|
@ -41,9 +41,7 @@ If you want to support the official hosted deployment and help us scale the poor
|
|||
|
||||
This sheet carries two cases: the ugly fake-pixel badge and a dense
|
||||
higher-resolution landscape. The badge row shows the core salvage story. The
|
||||
landscape row is now generated through automatic lattice inference as well, so
|
||||
the preview shows the machine we actually ship instead of a pinned-size fairy
|
||||
tale wearing a serious hat.
|
||||
landscape row shows how the same automatic path handles a much larger source.
|
||||
|
||||
Each row carries its own inset, so the tiny details have nowhere to hide.
|
||||
|
||||
|
|
@ -194,8 +192,7 @@ Run the focused test suite with:
|
|||
## Regenerating README Assets
|
||||
|
||||
The README images are generated from repo-tracked fixtures, not from random
|
||||
artifacts left lying around. The dense landscape row runs automatic lattice
|
||||
inference instead of pinning a fixed output size:
|
||||
artifacts left lying around:
|
||||
|
||||
```powershell
|
||||
.venv\Scripts\python scripts\generate_readme_previews.py --out-sheet docs\readme-assets\badge-example-sheet.png --out-guard-crop docs\readme-assets\guard-right-crop-comparison.png --scratch-dir artifacts\readme-build --device auto
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 726 KiB After Width: | Height: | Size: 757 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
|
@ -258,6 +258,24 @@ def _build_pip_inset(
|
|||
return canvas
|
||||
|
||||
|
||||
def _pip_size_for_crop(
|
||||
rgba_crop: np.ndarray,
|
||||
*,
|
||||
max_width: int,
|
||||
max_height: int,
|
||||
padding: int = 12,
|
||||
) -> tuple[int, int]:
|
||||
crop_height, crop_width = rgba_crop.shape[:2]
|
||||
if crop_width <= 0 or crop_height <= 0:
|
||||
return max_width, max_height
|
||||
inner_max_width = max(1, max_width - padding)
|
||||
inner_max_height = max(1, max_height - padding)
|
||||
aspect = crop_width / max(1, crop_height)
|
||||
inner_width = int(round(inner_max_height * aspect))
|
||||
inner_width = max(min(inner_width, inner_max_width), min(inner_max_width, inner_max_height))
|
||||
return inner_width + padding, inner_max_height + padding
|
||||
|
||||
|
||||
def _add_pip_inset(render: RenderedPanel, inset: Image.Image, *, margin_x: int = 12, margin_y: int = 12) -> None:
|
||||
inner_x, inner_y, inner_w, inner_h = render.content_box
|
||||
placement_x = inner_x + max(0, inner_w - inset.width - margin_x)
|
||||
|
|
@ -359,7 +377,8 @@ def _build_row_panels(
|
|||
_crop_rgba(row.phase_field_rgba, row.focus_cell_bbox),
|
||||
]
|
||||
for panel, crop in zip(panels, inset_crops, strict=True):
|
||||
_add_pip_inset(panel, _build_pip_inset(crop, width=inset_width, height=inset_height), margin_x=4, margin_y=4)
|
||||
pip_width, pip_height = _pip_size_for_crop(crop, max_width=inset_width, max_height=inset_height)
|
||||
_add_pip_inset(panel, _build_pip_inset(crop, width=pip_width, height=pip_height), margin_x=4, margin_y=4)
|
||||
return panels, focus_source_bbox
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue