Crochet Engine

io.github.dengyu123456由 GitHub 帳號 dengyu123456 發布v0.1.1更新於 Oct 24, 2026

Deterministic photo-to-crochet-chart engine: stitch counts, 5 techniques, yarn estimates.

已驗證STDIO僅桌面效率與工作流媒體與設計

概覽

AI 產生的概覽

將照片或 ASCII 設計轉換為鉤針編織圖,提供精確針數、技法預設與毛線用量估算。

可以做什麼
這是一個透過 stdio 暴露的確定性照片轉鉤針編織圖引擎。工具包括 photo_to_chart(本機圖片路徑轉為編織圖 PNG 及每色針數)、render_ascii_design(ASCII 設計檔轉為編織圖 PNG 和針數)以及 estimate_yarn_tool(依針數估算某一毛線粗細或全部的每色碼數)。支援五種技法預設(graph、c2c、tapestry、mosaic、filet),採用縮放、中位切分顏色量化與雜色清理,而非 AI 影像生成。
適用情境
當助理需要把照片或 ASCII 設計轉換為可重現針數的鉤針編織圖,或為編織圖估算毛線碼數時使用。適合重視精確、可重複輸出而非生成式影像的編織圖案規劃。
執行需求
以 Python 套件(crochetpatterngen-engine)透過 stdio 在本機執行;可用 pip 安裝,可選 mcp 附加項,或透過 uvx 執行。需要 Python 及 Pillow、numpy;背景移除需要可選的 rembg 附加項。未宣告帳號、API 金鑰或環境變數。僅限桌面端。
安裝前請注意
它會讀取本機圖片或設計檔路徑,並可將編織圖 PNG 寫入 output_path,因此只指向你打算處理的檔案,並謹慎選擇輸出位置。未顯示需要憑證、付款或向第三方分享資料。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Crochet Engine,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

crochetpatterngen-engine

The deterministic photo-to-crochet-chart engine behind crochetpatterngen.com — packaged as a Python library, CLI, and MCP server so AI agents (Claude Desktop, Cursor, etc.) can turn photos into crochet charts with exact stitch counts.

Deterministic, not generative. There is no AI image generation here — just resize, median-cut color quantization, and confetti cleanup. Same input, same chart, same stitch counts, every time. No hallucinated rows.

Why this engine

  • Real stitch counts — every chart comes with per-color hex + stitch counts that sum exactly to the grid size. What you see is what you crochet.
  • C2C block aspect correction — C2C blocks are physically wider than tall (0.7:1 h:w). The engine adjusts grid dimensions so the worked piece keeps the photo's proportions instead of coming out squashed.
  • 5 technique presets — graph, c2c, tapestry, mosaic, filet.
  • Yarn estimation — per-color yardage for 6 yarn weights (fingering → super bulky).
  • Zero heavy deps — Pillow + numpy only. Optional rembg extra for background removal.

Install

bash
pip install crochetpatterngen-engine          # corepip install crochetpatterngen-engine[mcp]     # + MCP serverpip install crochetpatterngen-engine[rembg]   # + background removal

Python API

python
from PIL import Imagefrom crochet_chart_engine import generate_chart, render_design, estimate_yarn
png_bytes, meta = generate_chart(    Image.open("photo.jpg"),    technique="c2c",     # graph | c2c | tapestry | mosaic | filet    grid_w=60,           # 20..120    n_colors=8,          # 2..16)# meta: {"grid_w", "grid_h", "colors": [{"hex", "count"}],#        "total_stitches", "technique", "warning"}
yarn = estimate_yarn(meta, weight="worsted")# {"total_yards": ..., "colors": [{"hex", "count", "yards"}], ...}
png_bytes, meta = render_design("designs/frog.txt")  # ASCII design -> chart

CLI

bash
crochet-chart chart photo.jpg out.png --technique c2c --grid-w 60 --colors 8crochet-chart design designs/frog.txt frog.pngcrochet-chart yarn photo.jpg --technique graph --weight worsted

MCP server (Claude Desktop & friends)

Add to claude_desktop_config.json:

json
{  "mcpServers": {    "crochet": {      "command": "uvx",      "args": ["--from", "crochetpatterngen-engine[mcp]", "crochetpatterngen-mcp"]    }  }}

Or with a regular pip install:

json
{  "mcpServers": {    "crochet": {      "command": "python",      "args": ["-m", "crochet_chart_engine.mcp_server"]    }  }}

Tools exposed (stdio transport):

ToolWhat it does
photo_to_chartLocal image path → chart PNG (base64 or saved to output_path) + per-color stitch counts JSON
render_ascii_designASCII design file → chart PNG + stitch counts
estimate_yarn_toolStitch counts → per-color yardage for one yarn weight or all

ASCII design format

See designs/frog.txt and designs/dragon.txt:

# commentpalette: G=#58A05C, W=#FFFFFF, .=#FAFAF7title: Frog Facetechnique: graph---..GGGG..........GGGG.....GGWWGG........GGWWGG...

One character per stitch; . is the background/padding color. Rows are padded to the longest row.

Development

bash
pip install -e .[dev,mcp]pytest tests/

License

MIT — see LICENSE.


Free web tool + pattern library at crochetpatterngen.com.

來源:README.md,提交 31b75ce

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分