lovstudio-find-logo

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

find-logo — collect brand logos, prefer wide + transparent

find-logo — 收集品牌logo,优先选择宽比例+透明格式

Takes a brand name or URL, probes Clearbit + the site's own og:image /
<link rel=icon>
/ favicon, scores each candidate, and archives the best one plus a couple of alternates into
~/.lovstudio/logo-collection/<slug>/
.
输入品牌名称或URL,探测Clearbit及目标网站的og:image /
<link rel=icon>
/ favicon资源,对每个候选logo评分,并将最优logo及若干备选logo归档至
~/.lovstudio/logo-collection/<slug>/
目录。

When to Use

使用场景

  • User asks to collect one or more brand logos for a slide/poster/site lineup
  • User names companies to drop into a partners/press strip
  • User gives a URL and wants its logo pulled down cleanly
  • 用户需要为幻灯片/海报/网站阵容收集一个或多个品牌logo
  • 用户指定公司名称,需要将其logo添加至合作伙伴/媒体展示栏
  • 用户提供URL,需要干净地提取该网站的logo

Workflow (MANDATORY)

工作流程(必须遵循)

Step 1: Identify each brand

步骤1:识别每个品牌

Accept any mix of names and URLs. If the user gave only a name with no obvious domain, ask — don't silently guess
.com
(script will guess, but for non-US or ambiguous brands that fails).
Use
AskUserQuestion
when:
  • Brand name is ambiguous (e.g. "Apple" = fruit vs. Inc.)
  • No URL and the domain isn't guessable (
    xAI
    x.ai
    , not
    xai.com
    )
  • User gave a list without URLs
接受名称和URL的任意组合。如果用户仅提供名称且无明确域名,需主动询问——不要默认猜测
.com
(脚本会自动猜测,但对于非美国品牌或名称模糊的品牌,这种猜测可能失效)。
在以下场景中使用
AskUserQuestion
  • 品牌名称存在歧义(例如“Apple”可能指水果或苹果公司)
  • 未提供URL且域名无法准确猜测(如
    xAI
    对应
    x.ai
    ,而非
    xai.com
  • 用户提供了无URL的品牌列表

Step 2: Fetch — one brand per invocation

步骤2:获取logo — 每次调用处理一个品牌

bash
python3 ~/.claude/skills/lovstudio-find-logo/scripts/find_logo.py \
  --name "Anthropic" --url https://anthropic.com --json
For a batch, loop; the script is idempotent per
<slug>/
(re-runs overwrite).
bash
python3 ~/.claude/skills/lovstudio-find-logo/scripts/find_logo.py \
  --name "Anthropic" --url https://anthropic.com --json
批量处理时可循环调用;脚本针对
<slug>/
目录具有幂等性(重复运行会覆盖现有内容)。

Step 3: Inspect score; fall back to WebSearch if needed

步骤3:检查评分;必要时回退至WebSearch

  • Exit code
    0
    → logo archived. The printed
    score
    is your quality signal:
    • ≥ 60
      — solid: SVG or transparent PNG with wide/square aspect
    • 20–60
      — usable: probably a favicon or small PNG
    • < 20
      — weak: only ICO or tiny stub found
  • Exit code
    2
    /
    status: "no-candidates"
    → script found nothing. Do NOT give up. Use
    WebSearch
    for
    "<brand> logo svg site:*.com"
    or the brand's press-kit page, then re-invoke with
    --url <direct-image-url>
    is not supported — if you have a direct image URL,
    curl -o
    it into
    ~/.lovstudio/logo-collection/<slug>/logo.<ext>
    and hand-write
    meta.json
    using the existing layout as a template.
  • 退出码
    0
    → logo已归档。输出的
    score
    为质量信号:
    • ≥ 60
      — 优质:SVG或透明PNG格式,宽比例/正方形
    • 20–60
      — 可用:可能是favicon或小型PNG
    • < 20
      — 劣质:仅找到ICO或极小的占位图
  • 退出码
    2
    /
    status: "no-candidates"
    → 脚本未找到任何资源。 不要放弃。使用
    WebSearch
    搜索
    "<brand> logo svg site:*.com"
    或品牌的新闻素材页面,若获取到直接图片URL,不支持通过
    --url <direct-image-url>
    重新调用脚本——需使用
    curl -o
    将图片保存至
    ~/.lovstudio/logo-collection/<slug>/logo.<ext>
    ,并参照现有模板手动编写
    meta.json
    文件。

Step 4: Report

步骤4:反馈结果

Report back with the archive path and the primary's aspect + format. If the score is weak, tell the user and offer to retry with a specific press-kit URL or Wikipedia SVG.
向用户反馈归档路径及主logo的比例和格式。若评分较低,需告知用户并提供重试选项,可指定新闻素材URL或Wikipedia SVG链接。

CLI Reference

CLI参考

ArgumentDefaultDescription
--name
Brand/product name. Used for slug + meta.
--url
Official URL or bare domain. Overrides the name-based domain guess.
--slug
slugified nameOverride the directory slug under the archive root.
--out
~/.lovstudio/logo-collection
Archive root.
--keep-alts
2
How many runner-up candidates to keep as
alt-N.<ext>
.
--json
offEmit a JSON result to stdout (use this when chaining).
At least one of
--name
or
--url
is required.
参数默认值描述
--name
品牌/产品名称,用于生成slug和元数据。
--url
官方URL或裸域名,会覆盖基于名称的域名猜测。
--slug
名称转换后的slug覆盖归档根目录下的目录slug。
--out
~/.lovstudio/logo-collection
归档根目录。
--keep-alts
2
保留的备选logo数量,命名格式为
alt-N.<ext>
--json
关闭向标准输出输出JSON结果(链式调用时使用)。
必须提供
--name
--url
中的至少一个。

Archive Layout

归档目录结构

~/.lovstudio/logo-collection/
├── anthropic/
│   ├── logo.png            # primary (highest score)
│   ├── alt-1.png           # runner-ups
│   ├── alt-2.png
│   └── meta.json           # sources, scores, dimensions, fetched_at
├── vercel/
│   ├── logo.png            # 1200x628 transparent banner
│   └── ...
└── stripe/
    ├── logo.svg
    └── ...
~/.lovstudio/logo-collection/
├── anthropic/
│   ├── logo.png            # 主logo(评分最高)
│   ├── alt-1.png           # 备选logo
│   ├── alt-2.png
│   └── meta.json           # 来源、评分、尺寸、获取时间
├── vercel/
│   ├── logo.png            # 1200x628透明横幅
│   └── ...
└── stripe/
    ├── logo.svg
    └── ...

Scoring Heuristic (why a candidate wins)

评分规则(候选logo胜出原因)

  • Format: SVG (+40) > PNG (+20) > WebP (+10) > JPG (-10) > ICO (-20)
  • Transparency:
    +30
    if alpha channel present (SVG always counts)
  • Aspect ratio:
    +25
    for wide (≥2:1),
    +10
    for landscape (≥1.3:1),
    -5
    for square,
    -15
    for tall/portrait
  • Short edge:
    +15
    if ≥128px,
    +5
    if ≥64px,
    -20
    if <32px
  • Size sanity:
    -30
    if payload <400 bytes (almost certainly a stub)
This matches the "prefer 长条形 + rgba" preference — wide transparent logos come out on top, square favicons land as alternates.
  • 格式:SVG(+40) > PNG(+20) > WebP(+10) > JPG(-10) > ICO(-20)
  • 透明度:存在alpha通道时+30(SVG默认符合)
  • 比例:宽比例(≥2:1)+25,横版(≥1.3:1)+10,正方形-5,竖版/ portrait-15
  • 短边长度:≥128px+15,≥64px+5,<32px-20
  • 文件大小合理性:文件大小<400字节时-30(几乎可以肯定是占位图)
该规则符合“优先选择长条形+rgba”的偏好——宽透明logo排名最高,正方形favicon作为备选。

Dependencies

依赖

Stdlib only (urllib, html.parser, argparse). No
pip install
required.
仅使用标准库(urllib、html.parser、argparse),无需
pip install
安装额外依赖。

Known Limits

已知限制

  • The name → domain guess is a crude lowercase-strip +
    .com
    suffix. For anything not on
    .com
    , pass
    --url
    explicitly.
  • No Clearbit API key is used — we hit the unauthenticated endpoint, which covers most major brands but not all.
  • WebSearch
    fallback is Claude's responsibility, not the script's.
  • 名称→域名的猜测逻辑较为简单:转换为小写后添加
    .com
    后缀。对于非
    .com
    域名的品牌,需显式传递
    --url
    参数。
  • 未使用Clearbit API密钥——调用的是未认证端点,覆盖大多数主流品牌,但并非全部。
  • WebSearch回退逻辑由Claude负责,而非脚本本身。