lovstudio-find-logo
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesefind-logo — collect brand logos, prefer wide + transparent
find-logo — 收集品牌logo,优先选择宽比例+透明格式
Takes a brand name or URL, probes Clearbit + the site's own og:image /
/ favicon, scores each candidate, and archives the best
one plus a couple of alternates into .
<link rel=icon>~/.lovstudio/logo-collection/<slug>/输入品牌名称或URL,探测Clearbit及目标网站的og:image /
/ favicon资源,对每个候选logo评分,并将最优logo及若干备选logo归档至目录。
<link rel=icon>~/.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 (script will guess, but for non-US or
ambiguous brands that fails).
.comUse when:
AskUserQuestion- Brand name is ambiguous (e.g. "Apple" = fruit vs. Inc.)
- No URL and the domain isn't guessable (→
xAI, notx.ai)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 --jsonFor a batch, loop; the script is idempotent per (re-runs overwrite).
<slug>/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 → logo archived. The printed
0is your quality signal:score- — solid: SVG or transparent PNG with wide/square aspect
≥ 60 - — usable: probably a favicon or small PNG
20–60 - — weak: only ICO or tiny stub found
< 20
- Exit code /
2→ script found nothing. Do NOT give up. Usestatus: "no-candidates"forWebSearchor the brand's press-kit page, then re-invoke with"<brand> logo svg site:*.com"is not supported — if you have a direct image URL,--url <direct-image-url>it intocurl -oand hand-write~/.lovstudio/logo-collection/<slug>/logo.<ext>using the existing layout as a template.meta.json
- 退出码→ logo已归档。输出的
0为质量信号:score- — 优质:SVG或透明PNG格式,宽比例/正方形
≥ 60 - — 可用:可能是favicon或小型PNG
20–60 - — 劣质:仅找到ICO或极小的占位图
< 20
- 退出码/
2→ 脚本未找到任何资源。 不要放弃。使用status: "no-candidates"搜索WebSearch或品牌的新闻素材页面,若获取到直接图片URL,不支持通过"<brand> logo svg site:*.com"重新调用脚本——需使用--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参考
| Argument | Default | Description |
|---|---|---|
| — | Brand/product name. Used for slug + meta. |
| — | Official URL or bare domain. Overrides the name-based domain guess. |
| slugified name | Override the directory slug under the archive root. |
| | Archive root. |
| | How many runner-up candidates to keep as |
| off | Emit a JSON result to stdout (use this when chaining). |
At least one of or is required.
--name--url| 参数 | 默认值 | 描述 |
|---|---|---|
| — | 品牌/产品名称,用于生成slug和元数据。 |
| — | 官方URL或裸域名,会覆盖基于名称的域名猜测。 |
| 名称转换后的slug | 覆盖归档根目录下的目录slug。 |
| | 归档根目录。 |
| | 保留的备选logo数量,命名格式为 |
| 关闭 | 向标准输出输出JSON结果(链式调用时使用)。 |
必须提供或中的至少一个。
--name--urlArchive 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: if alpha channel present (SVG always counts)
+30 - Aspect ratio: for wide (≥2:1),
+25for landscape (≥1.3:1),+10for square,-5for tall/portrait-15 - Short edge: if ≥128px,
+15if ≥64px,+5if <32px-20 - Size sanity: if payload <400 bytes (almost certainly a stub)
-30
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 required.
pip install仅使用标准库(urllib、html.parser、argparse),无需安装额外依赖。
pip installKnown Limits
已知限制
- The name → domain guess is a crude lowercase-strip + suffix. For anything not on
.com, pass.comexplicitly.--url - No Clearbit API key is used — we hit the unauthenticated endpoint, which covers most major brands but not all.
- fallback is Claude's responsibility, not the script's.
WebSearch
- 名称→域名的猜测逻辑较为简单:转换为小写后添加后缀。对于非
.com域名的品牌,需显式传递.com参数。--url - 未使用Clearbit API密钥——调用的是未认证端点,覆盖大多数主流品牌,但并非全部。
- WebSearch回退逻辑由Claude负责,而非脚本本身。