Skip to content

1173206772/photo-skills / skills/hk-multiverse-photo

hk-multiverse-photo

Verified

Transform 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.

FileKindSize
SKILL.mdskill md11.7 KB
agents/openai.yamlconfig260 B
references/annotation-system.mdmarkdown13.7 KB
references/collision-layouts.mdmarkdown30.3 KB
references/universe-atlas.mdmarkdown9.3 KB
scripts/make_annotation_svg.pyexecutablescript14.0 KB
scripts/validate_image.pyexecutablescript8.1 KB

scripts/make_annotation_svg.py

View on GitHub
#!/usr/bin/env python3
"""Create a deterministic transparent HK//VERSE SVG annotation overlay."""

from __future__ import annotations

import argparse
import json
import math
import sys
from html import escape
from pathlib import Path
from typing import Any


PALETTE = {
    "U01": "#14D9E8",
    "U02": "#EEF3F5",
    "U03": "#F0A8D4",
    "U04": "#FFB21A",
    "U05": "#FF176F",
    "PHOTO": "#C9D2D8",
}


def _number(value: Any, field: str) -> float:
    if isinstance(value, bool) or not isinstance(value, (int, float)):
        raise ValueError(f"{field} must be a number")
    return float(value)


def _point(value: Any, field: str, width: int, height: int) -> tuple[float, float]:
    if not isinstance(value, list) or len(value) != 2:
        raise ValueError(f"{field} must be [x, y]")
    x = _number(value[0], f"{field}[0]")
    y = _number(value[1], f"{field}[1]")
    if not (0 <= x <= width and 0 <= y <= height):
        raise ValueError(f"{field} lies outside the {width}x{height} canvas")
    return x, y


def _color(value: Any) -> str:
    if value is None:
        return PALETTE["PHOTO"]
    text = str(value).upper()
    if text in PALETTE:
        return PALETTE[text]
    if text.startswith("#") and len(text) in (4, 7):
        return text
    raise ValueError(f"invalid color or universe id: {value}")


def _text(value: Any, fallback: str = "") -> str:
    return escape(str(value if value is not None else fallback), quote=True)


def _logo(x: float, y: float) -> str:
    dots = [
        (x + 8, y + 19, PALETTE["U05"]),
        (x + 23, y + 8, PALETTE["U01"]),
        (x + 39, y + 18, PALETTE["U02"]),
        (x + 34, y + 37, PALETTE["U04"]),
        (x + 13, y + 39, PALETTE["U03"]),
    ]
    lines = " ".join(
        f'<line x1="{dots[i][0]}" y1="{dots[i][1]}" '
        f'x2="{dots[(i + 1) % len(dots)][0]}" y2="{dots[(i + 1) % len(dots)][1]}" />'
        for i in range(len(dots))
    )
    circles = " ".join(
        f'<circle cx="{cx}" cy="{cy}" r="4.5" fill="{color}" />'
        for cx, cy, color in dots
    )
    return (
        f'<g class="orbit" stroke="#DCE6EA" stroke-width="1" opacity="0.8">{lines}</g>'
        f"<g>{circles}</g>"
        f'<text class="brand" x="{x + 55}" y="{y + 34}">HK</text>'
        f'<path d="M {x + 112} {y + 5} L {x + 99} {y + 43}" '
        f'stroke="{PALETTE["U01"]}" stroke-width="7" />'
        f'<path d="M {x + 124} {y + 5} L {x + 111} {y + 43}" '
        f'stroke="{PALETTE["U05"]}" stroke-width="7" />'
        f'<text class="brand small" x="{x + 137}" y="{y + 34}">VERSE</text>'
    )


def _callout(item: dict[str, Any], width: int, height: int) -> str:
    if not isinstance(item.get("label"), str) or not item["label"].strip():
        raise ValueError("callout.label must be a non-empty string")
    label = _text(item["label"])
    x, y = _point(item.get("label_at"), "callout.label_at", width, height)
    target_x, target_y = _point(item.get("target"), "callout.target", width, height)
    color = _color(item.get("color"))
    box_width = float(item.get("width", 250))
    if box_width < 120:
        raise ValueError("callout.width must be at least 120")
    line_height = 46
    if x + box_width > width or y + line_height > height:
        raise ValueError("callout label box lies outside the canvas")
    direction = 1 if target_x >= x + box_width / 2 else -1
    edge_x = x + box_width if direction == 1 else x
    elbow_x = edge_x + (32 * direction)
    if not 0 <= elbow_x <= width:
        raise ValueError("callout elbow lies outside the canvas")
    return f"""
    <g class="callout">
      <path d="M {edge_x:.1f} {y + line_height / 2:.1f} L {elbow_x:.1f} {y + line_height / 2:.1f}
               L {target_x:.1f} {target_y:.1f}" fill="none" stroke="{color}" />
      <circle cx="{target_x:.1f}" cy="{target_y:.1f}" r="5" fill="{color}" />
      <path d="M {x:.1f} {y:.1f} H {x + box_width - 16:.1f} L {x + box_width:.1f} {y + 16:.1f}
               V {y + line_height:.1f} H {x:.1f} Z" class="panel" />
      <path d="M {x:.1f} {y:.1f} H {x + box_width - 16:.1f}" stroke="{color}" />
      <text class="callout-text" x="{x + 16:.1f}" y="{y + 29:.1f}">{label}</text>
    </g>"""


def _radar_sectors(items: Any) -> str:
    if items is None:
        return ""
    if not isinstance(items, list) or not 1 <= len(items) <= 6:
        raise ValueError("radar.sectors must contain 1–6 objects")
    paths: list[str] = []
    radius = 46.0
    for index, item in enumerate(items):
        if not isinstance(item, dict):
            raise ValueError("each radar.sectors entry must be an object")
        start = _number(item.get("start"), f"radar.sectors[{index}].start") % 360
        end = _number(item.get("end"), f"radar.sectors[{index}].end") % 360
        delta = (end - start) % 360
        if delta == 0:
            raise ValueError("radar sector start and end must differ")
        start_rad = math.radians(start)
        end_rad = math.radians(end)
        start_x, start_y = radius * math.sin(start_rad), -radius * math.cos(start_rad)
        end_x, end_y = radius * math.sin(end_rad), -radius * math.cos(end_rad)
        large_arc = 1 if delta > 180 else 0
        color = _color(item.get("color"))
        paths.append(
            f'<path d="M {start_x:.2f} {start_y:.2f} A {radius:g} {radius:g} 0 '
            f'{large_arc} 1 {end_x:.2f} {end_y:.2f}" fill="none" '
            f'stroke="{color}" stroke-width="7" />'
        )
    return "".join(paths)


def render(config: dict[str, Any]) -> str:
    width = int(config.get("width", 1080))
    height = int(config.get("height", 1920))
    if width < 600 or height < 800:
        raise ValueError("canvas must be at least 600x800")

    layout = config.get("layout") or {}
    if not isinstance(layout, dict):
        raise ValueError("layout must be an object")
    title_x, title_y = _point(layout.get("title", [54, 58]), "layout.title", width, height)
    legend_x, legend_y = _point(
        layout.get("legend", [width - 272, 76]), "layout.legend", width, height
    )
    footer_y = _number(layout.get("footer_y", height - 90), "layout.footer_y")
    if not (0 <= footer_y <= height):
        raise ValueError("layout.footer_y lies outside the canvas")
    if title_x < 18 or title_y < 18 or title_x + 532 > width or title_y + 158 > height:
        raise ValueError("title module lies outside the canvas")
    if legend_x + 270 > width:
        raise ValueError("legend module lies outside the canvas")
    if footer_y + 24 > height:
        raise ValueError("footer module lies outside the canvas")

    record = _text(config.get("record"), "001")
    location = _text(config.get("location"), "HONG KONG / FIELD")
    title_cn = _text(config.get("title_cn"), "多元宇宙现场")
    title_en = _text(config.get("title_en"), "DIMENSION COLLISION")
    active = config.get("active") or []
    if not isinstance(active, list) or not 1 <= len(active) <= 6:
        raise ValueError("active must contain 1–6 strings")
    if not all(
        isinstance(item, str) and item.strip() and len(item) <= 18 for item in active
    ):
        raise ValueError("active entries must be non-empty strings of at most 18 characters")

    legend = config.get("legend") or []
    if not isinstance(legend, list) or not 1 <= len(legend) <= 6:
        raise ValueError("legend must contain 1–6 rows")
    if legend_y + 27 + (len(legend) - 1) * 34 > height:
        raise ValueError("legend rows lie outside the canvas")
    legend_rows: list[str] = []
    for index, item in enumerate(legend):
        if not isinstance(item, dict):
            raise ValueError("each legend entry must be an object")
        for key in ("id", "label", "role"):
            if not isinstance(item.get(key), str) or not item[key].strip():
                raise ValueError(f"legend.{key} must be a non-empty string")
        universe_id = _text(item["id"])
        label = _text(item["label"])
        role = _text(item["role"])
        color = _color(item.get("color", item.get("id", "PHOTO")))
        row_y = legend_y + 27 + index * 34
        legend_rows.append(
            f'<circle cx="{legend_x + 6:.1f}" cy="{row_y - 5:.1f}" r="4" fill="{color}" />'
            f'<text class="legend" x="{legend_x + 18:.1f}" y="{row_y:.1f}">'
            f'{universe_id}  {label}  / {role}</text>'
        )

    callouts = config.get("callouts") or []
    if not isinstance(callouts, list) or not 2 <= len(callouts) <= 5:
        raise ValueError("callouts must contain 2–5 entries")
    if not all(isinstance(item, dict) for item in callouts):
        raise ValueError("each callout entry must be an object")
    callout_svg = "".join(_callout(item, width, height) for item in callouts)

    footer = config.get("footer") or {}
    if not isinstance(footer, dict):
        raise ValueError("footer must be an object")
    footer_left = _text(footer.get("left"), "PHOTO BASE // SOURCE-LOCKED")
    footer_center = _text(footer.get("center"), "2D / 3D / PHOTO")
    footer_right = _text(footer.get("right"), "ONE CITY // MANY REALITIES")

    radar_value = config.get("radar", {})
    radar_svg = ""
    if radar_value is not False:
        radar = {} if radar_value is None else radar_value
        if not isinstance(radar, dict):
            raise ValueError("radar must be false or an object")
        radar_x, radar_y = _point(
            radar.get("at", [76, height - 210]), "radar.at", width, height
        )
        if radar_x < 60 or radar_x + 60 > width or radar_y < 60 or radar_y + 80 > height:
            raise ValueError("radar module lies outside the canvas")
        sector_svg = _radar_sectors(radar.get("sectors"))
        phase_vector = "" if sector_svg else f"""
          <path d="M 0 0 L 33 -35" stroke="{_color(config.get('primary', 'U01'))}" />
          <circle cx="33" cy="-35" r="5" fill="{_color(config.get('primary', 'U01'))}" />"""
        radar_svg = f"""
        <g class="radar" transform="translate({radar_x:.1f} {radar_y:.1f})">
          <circle r="52" /><circle r="34" /><circle r="17" />
          <line x1="-58" y1="0" x2="58" y2="0" />
          <line x1="0" y1="-58" x2="0" y2="58" />
          {sector_svg}{phase_vector}
          <text class="micro" x="-10" y="78">PHASE // {record}</text>
        </g>"""

    active_lines = ["  ".join(_text(item) for item in active[:3])]
    if len(active) > 3:
        active_lines.append("  ".join(_text(item) for item in active[3:]))
    active_text_svg = "".join(
        f'<text class="micro" x="{title_x:.1f}" y="{title_y + 132 + index * 17:.1f}">'
        f'{"ACTIVE  " if index == 0 else ""}{line}</text>'
        for index, line in enumerate(active_lines)
    )
    style = """
    <style>
      text { fill: #F4F7F8; font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace; }
      .brand { font-family: "Arial Narrow", "Helvetica Neue", sans-serif; font-size: 42px; font-weight: 800; letter-spacing: 1px; }
      .brand.small { font-size: 23px; letter-spacing: 2px; }
      .eyebrow, .micro { font-size: 13px; letter-spacing: 2px; }
      .title-cn { font-size: 32px; font-weight: 800; }
      .title-en { font-size: 17px; font-weight: 700; letter-spacing: 1.2px; }
      .legend { font-size: 14px; font-weight: 700; }
      .callout-text { font-size: 15px; font-weight: 700; }
      .footer { font-size: 13px; font-weight: 700; letter-spacing: 0.8px; }
      .panel { fill: #071018; fill-opacity: 0.72; stroke: #DCE6EA; stroke-opacity: 0.28; }
      .callout path, .radar circle, .radar line, .radar path { stroke-width: 1.5; }
      .radar circle, .radar line { fill: none; stroke: #EAF1F3; stroke-opacity: 0.55; }
    </style>"""

    return f"""<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="{width}" height="{height}"
     viewBox="0 0 {width} {height}">
  {style}
  <g id="title-block">
    <path class="panel" d="M {title_x - 18:.1f} {title_y - 18:.1f} H {title_x + 510:.1f}
      L {title_x + 532:.1f} {title_y + 4:.1f} V {title_y + 158:.1f} H {title_x - 18:.1f} Z" />
    {_logo(title_x, title_y)}
    <text class="eyebrow" x="{title_x:.1f}" y="{title_y + 70:.1f}">FIELD // {record}  ·  {location}</text>
    <text class="title-cn" x="{title_x:.1f}" y="{title_y + 108:.1f}">{title_cn}</text>
    <text class="title-en" x="{title_x + 235:.1f}" y="{title_y + 108:.1f}">/ {title_en}</text>
    {active_text_svg}
  </g>
  <g id="field-map">
    <text class="eyebrow" x="{legend_x:.1f}" y="{legend_y:.1f}">FIELD MAP // ACTIVE</text>
    {''.join(legend_rows)}
  </g>
  <g id="callouts">{callout_svg}</g>
  {radar_svg}
  <g id="footer">
    <path d="M 50 {footer_y + 18:.1f} H {width * 0.22:.1f} M {width * 0.78:.1f} {footer_y + 18:.1f} H {width - 50:.1f}"
      stroke="#EAF1F3" stroke-opacity="0.65" />
    <text class="footer" x="50" y="{footer_y:.1f}">{footer_left}</text>
    <text class="footer" x="{width / 2:.1f}" y="{footer_y:.1f}" text-anchor="middle">{footer_center}</text>
    <text class="footer" x="{width - 50:.1f}" y="{footer_y:.1f}" text-anchor="end">{footer_right}</text>
  </g>
</svg>
"""


def main() -> int:
    parser = argparse.ArgumentParser(
        description="Create an exact-text transparent HK//VERSE SVG annotation overlay."
    )
    parser.add_argument("config", help="JSON annotation configuration")
    parser.add_argument("output", help="output SVG path")
    parser.add_argument(
        "--force", action="store_true", help="replace an existing SVG output"
    )
    args = parser.parse_args()

    config_path = Path(args.config).expanduser().resolve()
    output_path = Path(args.output).expanduser().resolve()
    try:
        config = json.loads(config_path.read_text(encoding="utf-8"))
        if not isinstance(config, dict):
            raise ValueError("configuration root must be an object")
        svg = render(config)
        if output_path.exists() and not args.force:
            raise ValueError("output already exists; pass --force to replace it")
        output_path.parent.mkdir(parents=True, exist_ok=True)
        output_path.write_text(svg, encoding="utf-8")
    except (OSError, json.JSONDecodeError, ValueError) as error:
        print(f"ERROR: {error}", file=sys.stderr)
        return 2

    print(f"WROTE: {output_path}")
    return 0


if __name__ == "__main__":
    sys.exit(main())
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
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: 196kUpdated Claude CodeCodexVerifiedInstall