1173206772/photo-skills / skills/hk-multiverse-photo
hk-multiverse-photo
VerifiedTransform supplied Hong Kong, city, street, vehicle, skyline, or harbor photographs into bold multiverse-collision still images that preserve source geometry while combining real photography, flat 2D animation, and dimensional 3D/cel rendering. Use for Spider-Verse-inspired city edits, cyberpunk universe collisions, distinct style fields, phase-wheel sectors, vehicle timeline portals, tram interchange scenes, Douyin/9:16 batches, selective frame revisions, coherent multi-image series, or original HK//VERSE archive annotations. Generate an original visual system without copying characters, official logos, or film frames. Do not use for video unless the user explicitly asks for motion.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.7 KB |
| agents/openai.yaml | config | 260 B |
| references/annotation-system.md | markdown | 13.7 KB |
| references/collision-layouts.md | markdown | 30.3 KB |
| references/universe-atlas.md | markdown | 9.3 KB |
| scripts/make_annotation_svg.pyexecutable | script | 14.0 KB |
| scripts/validate_image.pyexecutable | script | 8.1 KB |
scripts/validate_image.py
View on GitHub#!/usr/bin/env python3
"""Validate raster dimensions and delivery geometry without third-party packages."""
from __future__ import annotations
import argparse
import json
import struct
import sys
from pathlib import Path
class ProbeError(ValueError):
"""Raised when an image header cannot be read."""
def _png_size(data: bytes) -> tuple[int, int]:
if len(data) < 24 or data[:8] != b"\x89PNG\r\n\x1a\n":
raise ProbeError("invalid PNG header")
return struct.unpack(">II", data[16:24])
def _gif_size(data: bytes) -> tuple[int, int]:
if len(data) < 10 or data[:6] not in (b"GIF87a", b"GIF89a"):
raise ProbeError("invalid GIF header")
return struct.unpack("<HH", data[6:10])
def _jpeg_size(data: bytes) -> tuple[int, int]:
if len(data) < 4 or data[:2] != b"\xff\xd8":
raise ProbeError("invalid JPEG header")
offset = 2
sof_markers = {
0xC0,
0xC1,
0xC2,
0xC3,
0xC5,
0xC6,
0xC7,
0xC9,
0xCA,
0xCB,
0xCD,
0xCE,
0xCF,
}
while offset + 3 < len(data):
if data[offset] != 0xFF:
offset += 1
continue
while offset < len(data) and data[offset] == 0xFF:
offset += 1
if offset >= len(data):
break
marker = data[offset]
offset += 1
if marker in (0xD8, 0xD9) or 0xD0 <= marker <= 0xD7:
continue
if offset + 2 > len(data):
break
segment_length = struct.unpack(">H", data[offset : offset + 2])[0]
if segment_length < 2 or offset + segment_length > len(data):
break
if marker in sof_markers:
if segment_length < 7:
raise ProbeError("invalid JPEG SOF segment")
height, width = struct.unpack(">HH", data[offset + 3 : offset + 7])
return width, height
offset += segment_length
raise ProbeError("JPEG dimensions not found")
def _webp_size(data: bytes) -> tuple[int, int]:
if len(data) < 30 or data[:4] != b"RIFF" or data[8:12] != b"WEBP":
raise ProbeError("invalid WebP header")
kind = data[12:16]
payload = data[20:]
if kind == b"VP8X" and len(payload) >= 10:
width = 1 + int.from_bytes(payload[4:7], "little")
height = 1 + int.from_bytes(payload[7:10], "little")
return width, height
if kind == b"VP8L" and len(payload) >= 5 and payload[0] == 0x2F:
bits = int.from_bytes(payload[1:5], "little")
width = (bits & 0x3FFF) + 1
height = ((bits >> 14) & 0x3FFF) + 1
return width, height
if kind == b"VP8 " and len(payload) >= 10 and payload[3:6] == b"\x9d\x01\x2a":
width = struct.unpack("<H", payload[6:8])[0] & 0x3FFF
height = struct.unpack("<H", payload[8:10])[0] & 0x3FFF
return width, height
raise ProbeError("unsupported WebP encoding")
def probe(path: Path) -> tuple[int, int, str]:
data = path.read_bytes()
if data.startswith(b"\x89PNG"):
width, height = _png_size(data)
return width, height, "PNG"
if data.startswith(b"\xff\xd8"):
width, height = _jpeg_size(data)
return width, height, "JPEG"
if data.startswith((b"GIF87a", b"GIF89a")):
width, height = _gif_size(data)
return width, height, "GIF"
if data.startswith(b"RIFF"):
width, height = _webp_size(data)
return width, height, "WEBP"
raise ProbeError("supported formats are PNG, JPEG, GIF, and WebP")
def parse_target(value: str) -> tuple[int, int]:
try:
width_text, height_text = value.lower().split("x", 1)
width, height = int(width_text), int(height_text)
except (ValueError, AttributeError) as error:
raise argparse.ArgumentTypeError("target must look like 1080x1920") from error
if width <= 0 or height <= 0:
raise argparse.ArgumentTypeError("target dimensions must be positive")
return width, height
def validate(args: argparse.Namespace) -> dict[str, object]:
path = Path(args.image).expanduser().resolve()
checks: list[dict[str, object]] = []
result: dict[str, object] = {"path": str(path), "checks": checks, "ok": False}
if not path.is_file():
checks.append({"name": "file", "ok": False, "detail": "file not found"})
return result
checks.append({"name": "file", "ok": True, "detail": "readable file"})
try:
width, height, image_format = probe(path)
except (OSError, ProbeError) as error:
checks.append({"name": "header", "ok": False, "detail": str(error)})
return result
result.update(
{
"format": image_format,
"width": width,
"height": height,
"aspect_width_over_height": round(width / height, 6),
}
)
checks.append(
{"name": "header", "ok": True, "detail": f"{image_format} {width}x{height}"}
)
if args.profile in ("portrait", "douyin"):
checks.append(
{
"name": "orientation",
"ok": height > width,
"detail": "portrait required",
}
)
minimum_width = args.min_width
minimum_height = args.min_height
if args.profile == "portrait":
minimum_width = minimum_width or 900
minimum_height = minimum_height or 1200
elif args.profile == "douyin":
minimum_width = minimum_width or 1080
minimum_height = minimum_height or 1920
actual_ratio = width / height
target_ratio = 9 / 16
delta = abs(actual_ratio - target_ratio)
checks.append(
{
"name": "aspect",
"ok": delta <= args.aspect_tolerance,
"detail": (
f"expected 9:16 within {args.aspect_tolerance:.4f}; "
f"actual {actual_ratio:.6f}"
),
}
)
if minimum_width:
checks.append(
{
"name": "minimum_width",
"ok": width >= minimum_width,
"detail": f"expected >= {minimum_width}; actual {width}",
}
)
if minimum_height:
checks.append(
{
"name": "minimum_height",
"ok": height >= minimum_height,
"detail": f"expected >= {minimum_height}; actual {height}",
}
)
if args.target:
target_width, target_height = args.target
checks.append(
{
"name": "exact_target",
"ok": (width, height) == (target_width, target_height),
"detail": (
f"expected {target_width}x{target_height}; actual {width}x{height}"
),
}
)
result["ok"] = all(bool(check["ok"]) for check in checks)
return result
def main() -> int:
parser = argparse.ArgumentParser(
description="Validate raster dimensions for HK multiverse still-image delivery."
)
parser.add_argument("image", help="PNG, JPEG, GIF, or WebP image path")
parser.add_argument(
"--profile",
choices=("none", "portrait", "douyin"),
default="portrait",
help="geometry profile; douyin requires >=1080x1920 and approximately 9:16",
)
parser.add_argument("--min-width", type=int, default=0)
parser.add_argument("--min-height", type=int, default=0)
parser.add_argument("--target", type=parse_target, help="exact dimensions, e.g. 1080x1920")
parser.add_argument(
"--aspect-tolerance",
type=float,
default=0.01,
help="maximum absolute width/height ratio error for the Douyin profile",
)
parser.add_argument("--json", action="store_true", help="print JSON result")
args = parser.parse_args()
result = validate(args)
if args.json:
print(json.dumps(result, ensure_ascii=False, indent=2))
else:
status = "PASS" if result["ok"] else "FAIL"
print(f"{status}: {result['path']}")
for check in result["checks"]:
marker = "ok" if check["ok"] else "x"
print(f" [{marker}] {check['name']}: {check['detail']}")
return 0 if result["ok"] else 1
if __name__ == "__main__":
sys.exit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |