Skill站外收录 @skilllib/skill-2014279397472153602
post-process-logo
将原始标识图像统一转换为标准化的 256x256 PNG 格式,自动优选最接近方形的版本并添加透明填充以适配正方形输出,适用于协议元数据所需的图标规范化处理场景。
内容与媒体 AI 技能
Skills.MD
# Post-process logo
This skill transforms original logo images into standardised 256x256 PNG format suitable for vault protocol metadata. It automatically selects the most square variant from available logos and applies padding if needed to create a perfect square output.
## Required inputs
Before starting, gather the following from the user:
1. **Input folder** - Folder containing original logo files (e.g., `eth_defi/data/vaults/original_logos/protocol-name/`)
2. **Output folder** - Folder where processed logos should be saved (e.g., `eth_defi/data/vaults/formatted_logos/`)
3. **Variant preference** (optional) - Which variant(s) to process: `generic`, `light`, `dark`, or `all`
If any required input is missing, ask the user before proceeding.
## Prerequisites
Ensure the following are available:
1. Python dependencies installed: `poetry install --with dev`
Python Pillow is installed for detecting image format, dimensions, and transparency.
## Logo vocabulary
There is no universal standard how artist name their logo files for dark and light variants. In our case, we always say
- `light`: light (white) text on dark or transparent background
- `dark`: dark (black) text on white or transparent background
Following vocabulary is used:
- Brand mark: same as logo mark, the logo without the brand name text
- Word mark: the logo with the brand name text
## Step 1: Inventory input logos
List all image files in the input folder and classify them:
1. Identify file formats: SVG, PNG, JPG, WEBP, etc.
2. Classify by variant based on filename:
- `{slug}.generic.{ext}` - Generic/default theme
- `{slug}.light.{ext}` - Light background theme (dark logo)
- `{slug}.dark.{ext}` - Dark background theme (light logo)
3. Always prefer brand marks over word marks as source logo for post processing
4. **Check aspect ratio** of each logo:
- **Square aspect ratio**: Width equals height (1:1 ratio). Allow 90% tolerance in the detection as there might be one-off pixel errors in the source material.
- **Non-square**: Width differs from height - will need padding to become square
5. **Check if logos have transparent backgrounds**:
- **Transparent background**: PNG files with alpha channel transparency
- **Assume SVGs are always transparent**: SVG files the originals should never contain a solid background
6. Report findings to user, noting aspect ratios for each variant
## Step 2: Variant selection
### Automatic selection priority
1. **Pick the most square variant**: Calculate aspect ratio (min dimension / max dimension) for each variant and select the one closest to 1.0
2. **If multiple variants have the same squareness**:
- Prefer transparent variants (PNG with alpha, SVG)
- If still tied, prefer generic > light > dark
3. **If user specified a variant preference**: Use that variant regardless of squareness
## Step 3: Process logo
Process the selected logo variant. The script will automatically add padding to non-square logos to make them square before scaling.
```shell
export INPUT_IMAGE=/path/to/original/logo.png
export OUTPUT_IMAGE=/path/to/output/logo.generic.png
poetry run python scripts/logos/post-process-logo.py
```
The script will:
1. Convert SVG to PNG if needed
2. Add transparent padding to make the logo square (if non-square)
3. Remove background if not already transparent
4. Recolour for dark background (invert colours if logo is too dark to be visible on dark backgrounds)
5. Trim any excess padding and scale to 256x256
## Step 4: Report results
Provide the user with:
1. **Processed files** - List of all output files created
2. **File details** - Dimensions, file size for each
3. **Any issues** - Note any logos that couldn't be processed or had quality issues
## Output naming convention
Output files should follow this naming pattern:
- `{protocol-slug}/light.png` - For light backgrounds
- `{protocol-slug}/dark.png` - For dark backgrounds
## Troubleshooting
### SVG conversion issues
If SVG conversion fails:
1. Check if the SVG file is valid XML
2. Some complex SVGs may not render correctly
3. Try opening in a browser to verify the SVG displays properly
### Background removal issues
If the background isn't removed properly:
1. The logo may have complex edges or gradients
2. Try providing a higher resolution input
3. For logos that already have transparency, the script will skip background removal
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「post-process-logo」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次