Xpersona
B

Bitmap Vectorize

CLAWHUB · Unverified

将位图图像(截图、手绘照片、示意图等)转换为精确的矢量图形代码(SVG或Canvas)。当用户提供一张图片并希望将其重新绘制成可缩放、可编辑的矢量图形时,应使用本技能。特别适合物理示意图、几何图形、电路图、标注图等需要精确还原的场景。 Skill: Bitmap Vectorize Owner: wxdwqy Summary: 将位图图像(截图、手绘照片、示意图等)转换为精确的矢量图形代码(SVG或Canvas)。当用户提供一张图片并希望将其重新绘制成可缩放、可编辑的矢量图形时,应使用本技能。特别适合物理示意图、几何图形、电路图、标注图等需要精确还原的场景。 Tags: latest:1.0.0 Version history: v1.0.0 | 2026-03-29T11:50:50.183Z | auto Initial release. - Converts bitmap physics diagrams (screenshots, sketches, etc.) into precise vector graphic code (SVG or HTML Canvas). - Designed for workflows requiring carefu

62
Rank
84
Safety
982
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 982 downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17e2k3m41498pdbmx5e20e05d83t0pt:bitmap-vectorize
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-wxdwqy-bitmap-vectorize/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

12,850 characters of source documentation, loaded on request.

Extracted files

4 files captured from the source.

SKILL.md

---
name: bitmap-vectorize
version: 1.0.0
description: 将位图图像(截图、手绘照片、示意图等)转换为精确的矢量图形代码(SVG或Canvas)。当用户提供一张图片并希望将其重新绘制成可缩放、可编辑的矢量图形时,应使用本技能。特别适合物理示意图、几何图形、电路图、标注图等需要精确还原的场景。
---

# 物理位图矢量化(Physics Animation Prep)

## 概述

将高中物理题的示意图(位图)转换为精确的矢量图形代码,全程分 6 步完成任务。本技能为物理动画制作提供前期准备工作。

## 工作流程

### 第 0 步:建立坐标系和比例尺(关键!)

根据图像内容建立坐标系,并记录关键参数:

- 确定画布尺寸(宽×高),通常选择 800×500 或 600×400
- 确定原点位置和比例尺(1 个单位 = 多少像素)
- **重要**:Canvas 坐标系 y 轴向下(y 增大 = 向下),与数学坐标系相反
- 对于物理图形,先用数学坐标系推导,再转换到 Canvas 坐标系

### 第 1 步:识别原图中的元素组件

读取并分析用户提供的图像,识别以下元素:

- **物品名称**:水平地面、竖直墙面、小球、物块、细绳、轻杆、弹簧、斜面、圆弧轨道、电场 E、磁场 B、带电粒子 q 等
- **位置布局**:各元素的相对位置
- **相互关系**:接触、连接、束缚等关系

完成后向用户描述识别到的内容。

### 第 2 步:用题目文字校对第 1 步

获取用户提供的物理题目文字,逐项核对:

- 检查是否有遗漏的组件
- 检查位置布局是否正确
- 检查相互关系是否准确

**此步不可跳过**,必须与用户交互完成。

### 第 3 步:生成矢量图形

根据校对后的元素列表,生成矢量图形代码:

- 默认使用 **HTML Canvas**(方便后续生成动画)
- 检查:物品 ✓、位置 ✓、关系 ✓ 三者与原图一致
- **注意事项**(务必遵守):
  - Canvas y 轴向下,与数学/物理 y 轴相反
  - 圆弧角度:Canvas 中 0 = 3 点钟方向,顺时针为正
  - 对于复杂图形,先推导关键点坐标,再编码
- 如图像标注不清晰,可先描述识别到的结构,请用户确认后再绘制

### 第 4 步:校对矢量图

与用户交互,逐项检查:

- 背景是否正确
- 物体形状、大小是否一致
- 颜色是否正确
- 中英文标注是否准确

**此步必须与客户交互完成**。

### 第 5 步:按需导出

根据客户需求导出:

- **默认**:HTML Canvas(方便后续动画制作)
- **可选**:SVG 文件、PNG 图片

## Canvas 绘图要点

```javascript
// 坐标转换:数学坐标 → Canvas坐标
// 数学坐标 (mx, my) → Canvas坐标 (cx, cy)
// cx = originX + mx * scale
// cy = originY - my * scale  // 注意y轴方向反转

// 常用绘制方法
ctx.beginPath();
ctx.arc(cx, cy, radius, startAngle, endAngle);  // 圆弧
ctx.moveTo(x1, y1); ctx.lineTo(x2, y2);          // 直线
ctx.strokeStyle = '#333'; ctx.lineWidth = 2;
ctx.stroke();

// 虚线
ctx.setLineDash([5, 5]);
ctx.stroke();
ctx.setLineDash([]);  // 恢复实线

// 箭头
function drawArrow(ctx, fromX, fromY, toX, toY) {
    const headLen = 10;
    const angle = Math.atan2(toY - fromY, toX - fromX);
    ctx.beginPath();
    ctx.moveTo(fromX, fromY);
    ctx.lineTo(toX, toY);
    ctx.lineTo(toX - headLen * Math.cos(angle - Math.PI/6), toY - headLen * Math.sin(angle - Math.PI/6));
    ctx.moveTo(toX, toY);
    ctx.lineTo(toX - headLen * Math.cos(angle + Math.PI/6), toY - headLen * Math.sin(angle + Math.PI/6));
    ctx.stroke();
}
```

## 常见物理图形处理

### 圆弧槽(如半圆形轨道)

```javascript
// 半圆弧,圆心在 (cx, cy),半径 R
// 在Canvas中:从 π 到 0(顺时针方向)
ctx.arc(cx, cy, R, Math.PI, 0, false);  // 下半圆(Canvas中y向下)
```

### 带箭头坐标轴

```javascript
// x轴
drawArrow(ctx, 30, originY, width-20, originY);
ctx.fillText('x', width-15, originY+5);
// y轴(物理向上,Canvas向下绘制)
drawArrow(ctx, originX, height-20, originX, 20);
ctx.fillText('y', originX-15, 25);
```

### 标注点和虚线辅助线

```javascript
// 虚线从点到坐标轴
ctx.setLineDash([4, 4]);
ctx.beginPath();
ctx.moveTo(px, py);
ctx.lineTo(px, originY);  // 垂直虚线到x轴
ctx.stroke();
ctx.setLineDash([]);

// 标注点(实心圆)
ctx.beginPath();
ctx.arc(px, py, 4, 0, 2 * Math.PI);
ctx.fillStyle = 'black';
ctx.fill();
```

## references/

- `physics_shapes.md`:常见物理图形的 Canvas/SVG 代码片段(圆弧、力箭头、弹簧等)

## 注意事项(极其重要!)

_meta.json

{
  "ownerId": "kn7e9vqy0qy61cqa0db7g5csa583t5cc",
  "slug": "bitmap-vectorize",
  "version": "1.0.0",
  "publishedAt": 1774785050183
}

references/physics_shapes.md

# 常见物理图形 Canvas 代码片段

## 坐标系设置

```javascript
const width = 600, height = 400;
const originX = 80;   // 原点x(Canvas坐标)
const originY = 300;  // 原点y(Canvas坐标)
const scale = 80;     // 1单位 = 80px

// 数学坐标 → Canvas坐标
function toCanvas(mx, my) {
    return { x: originX + mx * scale, y: originY - my * scale };
}
```

## 带箭头坐标轴

```javascript
function drawAxes(ctx) {
    ctx.strokeStyle = '#333';
    ctx.lineWidth = 1.5;
    // x轴
    drawArrow(ctx, 30, originY, width - 20, originY);
    ctx.fillText('x', width - 12, originY + 5);
    // y轴
    drawArrow(ctx, originX, height - 20, originX, 20);
    ctx.fillText('y', originX - 15, 18);
}
```

## 半圆弧(槽/轨道)

```javascript
// 下半圆(开口向上,常见物理槽形状)
// 圆心在 Canvas (cx, cy),半径 R(像素)
ctx.beginPath();
ctx.arc(cx, cy, R, Math.PI, 0, false);  // 从左到右,下半圆
ctx.strokeStyle = '#2196F3';
ctx.lineWidth = 3;
ctx.stroke();

// 上半圆(开口向下)
ctx.arc(cx, cy, R, 0, Math.PI, false);
```

## 圆弧(任意角度)

```javascript
// 从角度 startAngle 到 endAngle(Canvas弧度,顺时针)
// Canvas角度:0=右,π/2=下,π=左,3π/2=上
ctx.beginPath();
ctx.arc(cx, cy, R, startAngle, endAngle, false);
ctx.stroke();
```

## 标注点

```javascript
function drawPoint(ctx, x, y, label, offsetX=8, offsetY=-8) {
    ctx.beginPath();
    ctx.arc(x, y, 4, 0, 2 * Math.PI);
    ctx.fillStyle = '#e74c3c';
    ctx.fill();
    ctx.fillStyle = '#333';
    ctx.font = 'bold 14px serif';
    ctx.fillText(label, x + offsetX, y + offsetY);
}
```

## 虚线辅助线

```javascript
function drawDashLine(ctx, x1, y1, x2, y2) {
    ctx.save();
    ctx.setLineDash([5, 5]);
    ctx.strokeStyle = '#999';
    ctx.lineWidth = 1;
    ctx.beginPath();
    ctx.moveTo(x1, y1);
    ctx.lineTo(x2, y2);
    ctx.stroke();
    ctx.restore();
}
```

## 箭头(力、速度方向)

```javascript
function drawArrow(ctx, fromX, fromY, toX, toY, color='#e74c3c') {
    const headLen = 12;
    const angle = Math.atan2(toY - fromY, toX - fromX);
    ctx.save();
    ctx.strokeStyle = color;
    ctx.fillStyle = color;
    ctx.lineWidth = 2;
    ctx.beginPath();
    ctx.moveTo(fromX, fromY);
    ctx.lineTo(toX, toY);
    ctx.stroke();
    // 箭头头部
    ctx.beginPath();
    ctx.moveTo(toX, toY);
    ctx.lineTo(toX - headLen * Math.cos(angle - Math.PI/6),
               toY - headLen * Math.sin(angle - Math.PI/6));
    ctx.lineTo(toX - headLen * Math.cos(angle + Math.PI/6),
               toY - headLen * Math.sin(angle + Math.PI/6));
    ctx.closePath();
    ctx.fill();
    ctx.restore();
}
```

## 实心球(运动的小球)

```javascript
function drawBall(ctx, x, y, r=10, color='#e74c3c') {
    const grad = ctx.createRadialGradient(x-r*0.3, y-r*0.3, r*0.1, x, y, r);
    grad.addColorStop(0, '#ff8a80');
    grad.addColorStop(1, color);
    ctx.beginPath();
    ctx.arc(x, y, r, 0, 2 * Math.PI);
    ctx.fillStyle = grad;
    ctx.fill();
}
```

## 弹簧

```javascript
function drawSpring(ctx, x1, y1, x2, y2, coils=6) {
    const dx = (x2 - x1) / (coils * 2

skill-card.md

## Description:

Converts bitmap physics, geometry, circuit, and annotated diagrams into precise editable vector code, with HTML Canvas as the default and SVG as an option.

This skill is ready for commercial/non-commercial use.

## Publisher:

[wxdwqy](https://clawhub.ai/user/wxdwqy)

### License/Terms of Use:

MIT-0

## Use Case:

Developers, educators, and agents use this skill to inspect bitmap problem diagrams, verify their components with the user, and produce scalable Canvas or SVG representations for physics animation preparation or editable diagram reuse.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: Bitmap interpretation may omit, misplace, or mislabel physics diagram elements.

Mitigation: Use the skill's required problem-text cross-check and user verification steps before final vector code or export.

Risk: Chinese-first instructions may be less accessible for users who need fully bilingual documentation.

Mitigation: Confirm labels, workflow steps, and final output requirements with users who need English coverage.

## Reference(s):

- [ClawHub Skill Page](https://clawhub.ai/wxdwqy/skills/bitmap-vectorize)
- [Common Physics Shapes Reference](references/physics_shapes.md)

## Skill Output:

**Output Type(s):** [Text, Markdown, Code, Guidance]

**Output Format:** [Markdown with HTML Canvas or SVG code blocks]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Default output is HTML Canvas code; SVG and PNG export may be provided on request after user verification.]

## Skill Version(s):

1.0.0 (source: frontmatter and server release evidence)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to Bitmap Vectorize and adjacent AI workflows.