vibedgames 0.8.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -8
- package/assets/align-framing.py +242 -0
- package/assets/render-model.py +406 -0
- package/assets/tilemap-editor.html +630 -0
- package/dist/THIRD_PARTY_NOTICES.txt +59 -7
- package/dist/chunk-2KVQJKIZ.js +6495 -0
- package/dist/chunk-2SBBKY5C.js +16993 -0
- package/dist/chunk-2ZKS7V72.js +170 -0
- package/dist/{chunk-RAUJA3OY.js → chunk-3HGBIUM5.js} +21 -18
- package/dist/chunk-3UGGMFJJ.js +22 -0
- package/dist/{chunk-I6O4HIDY.js → chunk-42K3BJJH.js} +163 -131
- package/dist/chunk-43P4U7CB.js +104 -0
- package/dist/chunk-4FJXCS3K.js +741 -0
- package/dist/{chunk-NC5XCGYU.js → chunk-4UU622RK.js} +6 -5
- package/dist/{chunk-2QBYTIMH.js → chunk-5535KDYI.js} +1 -1
- package/dist/chunk-5YPLKGY3.js +87 -0
- package/dist/chunk-6KXXZXSO.js +475 -0
- package/dist/chunk-7RPLQWR2.js +91 -0
- package/dist/{chunk-C2IRIRAA.js → chunk-A556KALN.js} +15 -14
- package/dist/{chunk-N3XAUFKH.js → chunk-ABTUEIRC.js} +576 -301
- package/dist/{chunk-PEUP4MZR.js → chunk-AWJNAGPE.js} +6 -3
- package/dist/{chunk-QGEITHUP.js → chunk-BN3Q7UEC.js} +22 -19
- package/dist/chunk-BZOMEG3X.js +412 -0
- package/dist/{chunk-ZYCSYJWX.js → chunk-COSLGSVO.js} +14 -24
- package/dist/{chunk-PQDBCZRT.js → chunk-CTY2WZQK.js} +204 -158
- package/dist/{chunk-CU7UY5YJ.js → chunk-D2RF35HJ.js} +1 -1
- package/dist/chunk-DB7WVFS7.js +80 -0
- package/dist/chunk-DOOQUFPG.js +73 -0
- package/dist/chunk-E3FJUPLT.js +177 -0
- package/dist/chunk-E7NDOZ27.js +428 -0
- package/dist/chunk-F42QKWBB.js +39 -0
- package/dist/chunk-FXXVXDTW.js +168 -0
- package/dist/{chunk-VFFOT7KD.js → chunk-G66HRVDW.js} +1 -1
- package/dist/{chunk-CAKBGDCY.js → chunk-GKDUYJ7R.js} +5 -0
- package/dist/chunk-GLEW7VJQ.js +45 -0
- package/dist/{chunk-MGIASPED.js → chunk-H2C4QUTG.js} +9 -8
- package/dist/{chunk-HCMTSR7E.js → chunk-HRKVAXNN.js} +21 -17
- package/dist/{chunk-TLRL6FHW.js → chunk-HSMG6U7J.js} +10 -9
- package/dist/chunk-HX5Q63UA.js +48 -0
- package/dist/chunk-HYOXGNWS.js +53 -0
- package/dist/chunk-I5LELJSK.js +22 -0
- package/dist/{chunk-6FZPPUQH.js → chunk-JN4WZCR7.js} +5 -4
- package/dist/{chunk-QJZ72MSY.js → chunk-K36EOII3.js} +7 -6
- package/dist/chunk-KAGVI3CE.js +62 -0
- package/dist/chunk-KJK5CB6E.js +58 -0
- package/dist/chunk-KLFBAFXD.js +25 -0
- package/dist/{chunk-7MKUR7Y3.js → chunk-LONQWRTR.js} +112 -81
- package/dist/chunk-LORGE2NB.js +2484 -0
- package/dist/{chunk-HKA5LBYW.js → chunk-MEAO33XW.js} +22 -19
- package/dist/{chunk-PM5UOIKR.js → chunk-MR5KIFI7.js} +22 -21
- package/dist/{chunk-GCX5KQ6A.js → chunk-N2UHAQXC.js} +18 -11
- package/dist/chunk-NCX6LYNJ.js +117 -0
- package/dist/chunk-OGX4DKIS.js +215 -0
- package/dist/chunk-OPUCUUID.js +41 -0
- package/dist/chunk-Q2QC6KAZ.js +132 -0
- package/dist/{chunk-2GL2WJZX.js → chunk-Q3XQPNF6.js} +14 -14
- package/dist/{chunk-RYFO3ZPO.js → chunk-Q5NZNXJE.js} +15 -12
- package/dist/{chunk-JT2AU24K.js → chunk-QARXJGI5.js} +1 -1
- package/dist/chunk-QLCVLCPM.js +126 -0
- package/dist/chunk-R2WVORGD.js +91 -0
- package/dist/chunk-RKS7SI5L.js +64 -0
- package/dist/{chunk-4BGCA3W7.js → chunk-RPJR3S5S.js} +32 -18
- package/dist/chunk-RPSUFZAG.js +3307 -0
- package/dist/chunk-RRI23NK2.js +40 -0
- package/dist/chunk-S7HYWITX.js +57 -0
- package/dist/chunk-SBXCK2I2.js +48 -0
- package/dist/chunk-SUSX3QIA.js +62 -0
- package/dist/{chunk-PHEDW6C7.js → chunk-SXYQL4GK.js} +16 -7
- package/dist/{chunk-ZI6PKVXG.js → chunk-TMPBGXT4.js} +6 -5
- package/dist/chunk-TXOE5UY5.js +72 -0
- package/dist/chunk-U6DTE5IX.js +124 -0
- package/dist/chunk-UPHB5HWO.js +115 -0
- package/dist/chunk-UQ7VO6B3.js +91 -0
- package/dist/chunk-VB4WLJR2.js +47 -0
- package/dist/{chunk-FNYBZNW2.js → chunk-VIEKOGKG.js} +21 -3
- package/dist/{chunk-QIVCBUYD.js → chunk-VZEJ2ZHE.js} +18 -18
- package/dist/chunk-X75Y7LUW.js +126 -0
- package/dist/{chunk-Z4Z24FWO.js → chunk-YNCYMWER.js} +8 -5
- package/dist/chunk-ZHLPE6LI.js +71 -0
- package/dist/index.js +48 -34
- package/package.json +32 -16
- package/templates/none/src/main.ts +4 -0
- package/templates/none/vite.config.ts +0 -2
- package/templates/phaser/src/main.ts +0 -1
- package/templates/phaser/src/scenes/game-scene.ts +10 -8
- package/templates/phaser/vite.config.ts +0 -2
- package/templates/react-r3f/src/app.tsx +3 -1
- package/templates/react-r3f/src/main.tsx +1 -0
- package/templates/react-r3f/vite.config.ts +0 -2
- package/templates/threejs/src/main.ts +10 -1
- package/templates/threejs/vite.config.ts +0 -2
- package/LICENSE +0 -21
- package/dist/chunk-AYJQVZXY.js +0 -39
- package/dist/chunk-J6PKNPI2.js +0 -26
- package/dist/chunk-MJQSHP3Y.js +0 -415
- package/dist/chunk-MYFLYNPO.js +0 -68
package/README.md
CHANGED
|
@@ -29,7 +29,9 @@ vg login # authenticate via browser
|
|
|
29
29
|
vg logout # clear credentials
|
|
30
30
|
vg whoami # show current user
|
|
31
31
|
vg deploy [dir] # deploy a game directory (reads vibedgames.json or --slug)
|
|
32
|
+
vg deployments [delete <slug> --yes] # list your games, or delete one
|
|
32
33
|
vg fork <slug> [target] # fork a project's shipped source under a new slug
|
|
34
|
+
vg skills [name] # list the game-studio skills, or print one's SKILL.md
|
|
33
35
|
vg credits # credit balance + recent usage
|
|
34
36
|
vg factory [args…] # autonomous game agent (optional plugin, installs on first use)
|
|
35
37
|
vg completions <bash|zsh|fish> # print shell completions
|
|
@@ -69,8 +71,9 @@ of failing with a bare exit code.
|
|
|
69
71
|
installed as a platform-specific optional package on first use — the CLI itself
|
|
70
72
|
carries none of it.
|
|
71
73
|
|
|
72
|
-
`vg generate` calls the `generate
|
|
73
|
-
|
|
74
|
+
`vg generate` calls the `generate.*` procedures (`run`, `status`, `models`,
|
|
75
|
+
`schema`, `pricing`, `docs`, `upload`), the same ones the MCP `generate_*`
|
|
76
|
+
tools call — the server holds the provider API key, so generation works for any logged-in user with no local keys.
|
|
74
77
|
|
|
75
78
|
## Using with a coding agent
|
|
76
79
|
|
|
@@ -81,10 +84,13 @@ Run `vg init` in your project to install the full set of game-building skills
|
|
|
81
84
|
## How deploy works
|
|
82
85
|
|
|
83
86
|
1. Picks the build output (`dist`/`build`/`out`) when the directory is a project root
|
|
84
|
-
2. Walks the directory,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
2. Walks the directory, checks the caps and that `index.html` exists, and packs it into one
|
|
88
|
+
`.tgz` bundle
|
|
89
|
+
3. Calls `deploy.upload` with `bundle: true` (and the `--source` archive) — stages a deployment
|
|
90
|
+
beside the live one and gets a signed `/api/upload` URL for the bundle
|
|
91
|
+
4. PUTs the bundle there
|
|
92
|
+
5. Calls `deploy.upload` again with `publish: true` — the server unpacks the bundle and the game
|
|
93
|
+
switches to the new deployment at `{slug}.vibedgames.com`; until then the old one keeps serving
|
|
88
94
|
|
|
89
95
|
Passing `--source` also uploads a forkable source archive, which is what
|
|
90
96
|
`vg fork <slug>` downloads. It is off by default: the archive is readable by
|
|
@@ -92,7 +98,10 @@ any logged-in user, so shipping it is a publish and should be a deliberate act.
|
|
|
92
98
|
|
|
93
99
|
## Auth
|
|
94
100
|
|
|
95
|
-
|
|
96
|
-
polls until the
|
|
101
|
+
`vg login` is OAuth device authorization (RFC 8628): the CLI prints a code,
|
|
102
|
+
opens `/device` in the browser, and polls until the person approves it there.
|
|
103
|
+
The access token and its refresh token are stored at `~/.config/vg/auth.json`
|
|
104
|
+
and refreshed as needed; `vg logout` revokes them, as does Disconnect under
|
|
105
|
+
Settings → Connected apps.
|
|
97
106
|
`VG_TOKEN` overrides it (for CI and headless agents) and `VG_API_URL` points the
|
|
98
107
|
CLI at a non-production API.
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
#!/usr/bin/env -S uv run --python 3.12 --script
|
|
2
|
+
# /// script
|
|
3
|
+
# requires-python = ">=3.10"
|
|
4
|
+
# dependencies = ["pillow"]
|
|
5
|
+
# ///
|
|
6
|
+
"""Framing alignment and crop-zoom for the review gates.
|
|
7
|
+
|
|
8
|
+
Tier-1 (`diagnose_render.py`) compares frame-aligned silhouette masks, but the
|
|
9
|
+
shared camera (`render_model.py`) leaves a fixed margin while references
|
|
10
|
+
usually fill their frame — so a correct model false-fails on framing alone.
|
|
11
|
+
This tool measures the subject bbox of BOTH images (plain-background product
|
|
12
|
+
shots), then crops the render so the subject fills its frame the way the
|
|
13
|
+
reference fills its own. The camera is untouched: this is evidence alignment,
|
|
14
|
+
not a re-render. Crop math is recorded in a JSON sidecar so the next agent can
|
|
15
|
+
audit it.
|
|
16
|
+
|
|
17
|
+
uv run align_framing.py align --reference ref/door.jpg \
|
|
18
|
+
--render runs/structural/front.png --out runs/structural/front-aligned.png
|
|
19
|
+
|
|
20
|
+
Also the crop-zoom tool the authoring step needs (recessed heads, part
|
|
21
|
+
adjacency — detail the full frame hides):
|
|
22
|
+
|
|
23
|
+
uv run align_framing.py crop --image ref/barrel.jpg \
|
|
24
|
+
--box 0.25,0.02,0.75,0.30 --zoom 3 --out ref-zones/top-head.png
|
|
25
|
+
|
|
26
|
+
uv run align_framing.py --selftest
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
from __future__ import annotations
|
|
30
|
+
|
|
31
|
+
import argparse
|
|
32
|
+
import json
|
|
33
|
+
import sys
|
|
34
|
+
from pathlib import Path
|
|
35
|
+
|
|
36
|
+
from PIL import Image
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
I2T_DEFAULT = Path.home() / ".local/share/img2threejs"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def upstream_mask(img: Image.Image, i2t: Path):
|
|
43
|
+
"""Mask via upstream's own foreground masker so alignment agrees with the
|
|
44
|
+
tier-1 gate by construction (it excludes ground shadow; a naive border-
|
|
45
|
+
median threshold does not and over-measures fill on real JPEGs)."""
|
|
46
|
+
sys.path.insert(0, str(i2t / "forge" / "stage1_intake"))
|
|
47
|
+
from extract_pbr_evidence import build_foreground_mask # noqa: PLC0415
|
|
48
|
+
|
|
49
|
+
rgb = img.convert("RGB")
|
|
50
|
+
w, h = rgb.size
|
|
51
|
+
mask, _diag, _warn = build_foreground_mask(w, h, list(rgb.getdata()))
|
|
52
|
+
return w, h, mask
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def subject_bbox(img: Image.Image, threshold: int, i2t: Path) -> tuple[int, int, int, int]:
|
|
56
|
+
"""Bbox of the subject, preferring the gate's own masker."""
|
|
57
|
+
try:
|
|
58
|
+
w, h, mask = upstream_mask(img, i2t)
|
|
59
|
+
xs = [i % w for i, v in enumerate(mask) if v]
|
|
60
|
+
ys = [i // w for i, v in enumerate(mask) if v]
|
|
61
|
+
if xs:
|
|
62
|
+
return min(xs), min(ys), max(xs), max(ys)
|
|
63
|
+
except Exception as err: # noqa: BLE001 — fall back to the naive mask
|
|
64
|
+
print(f" (upstream masker unavailable: {err}; using border-median fallback)", file=sys.stderr)
|
|
65
|
+
|
|
66
|
+
rgb = img.convert("RGB")
|
|
67
|
+
w, h = rgb.size
|
|
68
|
+
px = rgb.load()
|
|
69
|
+
border = []
|
|
70
|
+
for x in range(0, w, max(1, w // 64)):
|
|
71
|
+
border.append(px[x, 0])
|
|
72
|
+
border.append(px[x, h - 1])
|
|
73
|
+
for y in range(0, h, max(1, h // 64)):
|
|
74
|
+
border.append(px[0, y])
|
|
75
|
+
border.append(px[w - 1, y])
|
|
76
|
+
border.sort()
|
|
77
|
+
bg = border[len(border) // 2]
|
|
78
|
+
|
|
79
|
+
x0, y0, x1, y1 = w, h, -1, -1
|
|
80
|
+
for y in range(h):
|
|
81
|
+
for x in range(w):
|
|
82
|
+
r, g, b = px[x, y]
|
|
83
|
+
if abs(r - bg[0]) + abs(g - bg[1]) + abs(b - bg[2]) > threshold:
|
|
84
|
+
if x < x0:
|
|
85
|
+
x0 = x
|
|
86
|
+
if x > x1:
|
|
87
|
+
x1 = x
|
|
88
|
+
if y < y0:
|
|
89
|
+
y0 = y
|
|
90
|
+
if y > y1:
|
|
91
|
+
y1 = y
|
|
92
|
+
if x1 < 0:
|
|
93
|
+
raise SystemExit("no foreground found — is the background non-uniform?")
|
|
94
|
+
return x0, y0, x1, y1
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def parse_bbox(spec: str, size: tuple[int, int]) -> tuple[int, int, int, int]:
|
|
98
|
+
v = [float(x) for x in spec.split(",")]
|
|
99
|
+
if all(0 <= x <= 1 for x in v):
|
|
100
|
+
v = [v[0] * size[0], v[1] * size[1], v[2] * size[0], v[3] * size[1]]
|
|
101
|
+
return round(v[0]), round(v[1]), round(v[2]), round(v[3])
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def sane(bbox: tuple[int, int, int, int], size: tuple[int, int]) -> bool:
|
|
105
|
+
# A subject bbox spanning ~the whole frame means the mask ate the
|
|
106
|
+
# background (soft JPEG gradients defeat both maskers).
|
|
107
|
+
w, h = size
|
|
108
|
+
return (bbox[2] - bbox[0]) < 0.98 * w or (bbox[3] - bbox[1]) < 0.98 * h
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def cmd_align(args: argparse.Namespace) -> int:
|
|
112
|
+
ref = Image.open(args.reference)
|
|
113
|
+
ren = Image.open(args.render)
|
|
114
|
+
|
|
115
|
+
if args.ref_bbox:
|
|
116
|
+
rx0, ry0, rx1, ry1 = parse_bbox(args.ref_bbox, ref.size)
|
|
117
|
+
else:
|
|
118
|
+
rx0, ry0, rx1, ry1 = subject_bbox(ref, args.bg_threshold, args.i2t)
|
|
119
|
+
if not sane((rx0, ry0, rx1, ry1), ref.size):
|
|
120
|
+
raise SystemExit(
|
|
121
|
+
"reference mask spans the whole frame — the background gradient defeated "
|
|
122
|
+
"both maskers. Eyeball the subject bounds (crop-zoom helps) and pass "
|
|
123
|
+
"--ref-bbox x0,y0,x1,y1 (px or 0-1 fractions); it is recorded in the sidecar."
|
|
124
|
+
)
|
|
125
|
+
if args.render_bbox:
|
|
126
|
+
nx0, ny0, nx1, ny1 = parse_bbox(args.render_bbox, ren.size)
|
|
127
|
+
else:
|
|
128
|
+
nx0, ny0, nx1, ny1 = subject_bbox(ren, args.bg_threshold, args.i2t)
|
|
129
|
+
|
|
130
|
+
ref_w, ref_h = ref.size
|
|
131
|
+
# How the reference's subject sits in its own frame.
|
|
132
|
+
fill = (ry1 - ry0 + 1) / ref_h
|
|
133
|
+
cx_frac = ((rx0 + rx1) / 2) / ref_w
|
|
134
|
+
cy_frac = ((ry0 + ry1) / 2) / ref_h
|
|
135
|
+
|
|
136
|
+
# Cut a square-ish window around the render's subject reproducing that fill
|
|
137
|
+
# and centring, clamped to the canvas.
|
|
138
|
+
subj_h = ny1 - ny0 + 1
|
|
139
|
+
side = subj_h / fill
|
|
140
|
+
cx = (nx0 + nx1) / 2
|
|
141
|
+
cy = (ny0 + ny1) / 2
|
|
142
|
+
left = max(0, round(cx - cx_frac * side))
|
|
143
|
+
top = max(0, round(cy - cy_frac * side))
|
|
144
|
+
right = min(ren.size[0], round(left + side))
|
|
145
|
+
bottom = min(ren.size[1], round(top + side))
|
|
146
|
+
|
|
147
|
+
out = Path(args.out)
|
|
148
|
+
out.parent.mkdir(parents=True, exist_ok=True)
|
|
149
|
+
ren.crop((left, top, right, bottom)).resize(ref.size).save(out)
|
|
150
|
+
|
|
151
|
+
sidecar = {
|
|
152
|
+
"reference": str(args.reference),
|
|
153
|
+
"refBboxSource": "override" if args.ref_bbox else "measured",
|
|
154
|
+
"render": str(args.render),
|
|
155
|
+
"referenceSubjectBbox": [rx0, ry0, rx1, ry1],
|
|
156
|
+
"renderSubjectBbox": [nx0, ny0, nx1, ny1],
|
|
157
|
+
"referenceHeightFill": round(fill, 4),
|
|
158
|
+
"cropBox": [left, top, right, bottom],
|
|
159
|
+
"resizedTo": list(ref.size),
|
|
160
|
+
}
|
|
161
|
+
Path(str(out) + ".json").write_text(json.dumps(sidecar, indent=2) + "\n")
|
|
162
|
+
print(f"aligned -> {out} (fill {fill:.3f}, crop {left},{top}..{right},{bottom}); math in {out}.json")
|
|
163
|
+
return 0
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def cmd_crop(args: argparse.Namespace) -> int:
|
|
167
|
+
img = Image.open(args.image)
|
|
168
|
+
w, h = img.size
|
|
169
|
+
fx0, fy0, fx1, fy1 = (float(v) for v in args.box.split(","))
|
|
170
|
+
box = (round(fx0 * w), round(fy0 * h), round(fx1 * w), round(fy1 * h))
|
|
171
|
+
crop = img.crop(box)
|
|
172
|
+
if args.zoom > 1:
|
|
173
|
+
crop = crop.resize((crop.width * args.zoom, crop.height * args.zoom), Image.NEAREST)
|
|
174
|
+
out = Path(args.out)
|
|
175
|
+
out.parent.mkdir(parents=True, exist_ok=True)
|
|
176
|
+
crop.save(out)
|
|
177
|
+
print(f"crop {box} zoom x{args.zoom} -> {out}")
|
|
178
|
+
return 0
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def selftest() -> int:
|
|
182
|
+
from PIL import ImageDraw
|
|
183
|
+
|
|
184
|
+
ref = Image.new("RGB", (200, 200), (230, 230, 230))
|
|
185
|
+
ImageDraw.Draw(ref).rectangle([40, 20, 160, 180], fill=(120, 80, 40)) # fill 0.805
|
|
186
|
+
ren = Image.new("RGB", (200, 200), (184, 184, 184))
|
|
187
|
+
ImageDraw.Draw(ren).rectangle([70, 60, 130, 140], fill=(120, 80, 40)) # small, margined
|
|
188
|
+
|
|
189
|
+
import tempfile
|
|
190
|
+
|
|
191
|
+
with tempfile.TemporaryDirectory() as td:
|
|
192
|
+
rp, np_, op = Path(td, "ref.png"), Path(td, "ren.png"), Path(td, "out.png")
|
|
193
|
+
ref.save(rp)
|
|
194
|
+
ren.save(np_)
|
|
195
|
+
ns = argparse.Namespace(
|
|
196
|
+
reference=rp, render=np_, out=op, bg_threshold=30,
|
|
197
|
+
i2t=Path("/nonexistent"), ref_bbox=None, render_bbox=None,
|
|
198
|
+
)
|
|
199
|
+
cmd_align(ns)
|
|
200
|
+
sidecar = json.loads(Path(str(op) + ".json").read_text())
|
|
201
|
+
assert sidecar["referenceHeightFill"] > 0.79, sidecar
|
|
202
|
+
aligned = Image.open(op)
|
|
203
|
+
bx0, by0, bx1, by1 = subject_bbox(aligned, 30, Path("/nonexistent"))
|
|
204
|
+
new_fill = (by1 - by0 + 1) / aligned.size[1]
|
|
205
|
+
assert abs(new_fill - sidecar["referenceHeightFill"]) < 0.06, (new_fill, sidecar)
|
|
206
|
+
print("selftest ok")
|
|
207
|
+
return 0
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def main() -> int:
|
|
211
|
+
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
212
|
+
ap.add_argument("--selftest", action="store_true")
|
|
213
|
+
sub = ap.add_subparsers(dest="cmd")
|
|
214
|
+
|
|
215
|
+
al = sub.add_parser("align", help="crop a render to the reference's framing")
|
|
216
|
+
al.add_argument("--reference", required=True, type=Path)
|
|
217
|
+
al.add_argument("--render", required=True, type=Path)
|
|
218
|
+
al.add_argument("--out", required=True, type=Path)
|
|
219
|
+
al.add_argument("--bg-threshold", type=int, default=30)
|
|
220
|
+
al.add_argument("--i2t", type=Path, default=I2T_DEFAULT, help="upstream clone (for its foreground masker)")
|
|
221
|
+
al.add_argument("--ref-bbox", help="override reference subject bbox: x0,y0,x1,y1 (px or 0-1 fractions)")
|
|
222
|
+
al.add_argument("--render-bbox", help="override render subject bbox (same format)")
|
|
223
|
+
|
|
224
|
+
cr = sub.add_parser("crop", help="crop-zoom a region (fractions of width/height)")
|
|
225
|
+
cr.add_argument("--image", required=True, type=Path)
|
|
226
|
+
cr.add_argument("--box", required=True, help="x0,y0,x1,y1 as 0-1 fractions")
|
|
227
|
+
cr.add_argument("--zoom", type=int, default=2)
|
|
228
|
+
cr.add_argument("--out", required=True, type=Path)
|
|
229
|
+
|
|
230
|
+
args = ap.parse_args()
|
|
231
|
+
if args.selftest:
|
|
232
|
+
return selftest()
|
|
233
|
+
if args.cmd == "align":
|
|
234
|
+
return cmd_align(args)
|
|
235
|
+
if args.cmd == "crop":
|
|
236
|
+
return cmd_crop(args)
|
|
237
|
+
ap.error("pass a subcommand or --selftest")
|
|
238
|
+
return 2
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
if __name__ == "__main__":
|
|
242
|
+
raise SystemExit(main())
|