Token导航 LogoToken导航

Agent Skill · 图像处理

code-from-image(代码 from 图像)

用于辅助图像生成、图片编辑、视觉素材处理或图像模型工作流。它适合让 Agent 根据文本生成图片、处理背景、整理视觉提示词或调用相关图像工具。使用时需要确认输入图片、版权来源、输出格式和模型限制;涉及人物、品牌、商品或公开展示素材时,应额外核对授权、真实性和内容合规边界。

code-from-image 是图像处理类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证为 MIT,第三方扫描已通过,按安装量在图像处理类的 1,562 个 Skill 里排第 930。

总安装 2,165周安装 93GitHub Stars 93下载 759核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:code-from-image(代码 from 图像)
来源仓库:https://github.com/letta-ai/skills
仓库路径:skills/code-from-image
安装命令:
npx skills add https://github.com/letta-ai/skills --skill code-from-image
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/letta-ai/skills --skill code-from-image

这个 Skill 是做什么的

图像处理类 Skill 处理生成、裁剪、压缩和批量转换图片的任务。

code-from-image 提供从图像中提取代码或伪代码的指导,涵盖 OCR 工具选择与结果验证策略。适用于将截图、白板或文档图片中的代码转换为可运行脚本,常用于教学或遗留系统迁移。支持多种包管理器与图像处理库,优先检测 tesseract、pytesseract 和 Pillow 环境可用性。

使用前请确认图像清晰度与版权合法性,输出结果需经人工校验以避免 OCR 错误导致运行时问题。本技能不保证 100% 准确率,复杂布局或多语言混合内容建议分段处理并交叉验证语法正确性。

来源仓库内路径:skills/code-from-image

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/letta-ai/skills --skill code-from-image;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

code-from-image 怎么安装?

在终端执行 npx skills add https://github.com/letta-ai/skills --skill code-from-image。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

code-from-image 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

code-from-image 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

code-from-image 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

code-from-image 用的人多吗?

公开数据是累计安装 2,165 次,近一周安装 93 次,下载 759 次,GitHub 93 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

code-from-image 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理图像处理类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

图像处理类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
ai-image-generation

AI 图像生成 · Codex、Claude

4,365,552382调用外部服务未明确有提醒
openai-image-gen

OpenAI 图像生成 · OpenClaw

1,906,88432需要联网MIT-0有提醒
image

图像 · OpenClaw

525,99926需要联网MIT-0通过
baoyu-cover-image

宝玉封面图 · Codex、Claude

474,24016,779只读MIT有提醒
baoyu-image-gen

宝玉图像生成器 · Codex、Claude

468,00716,778接触敏感数据MIT通过
code-from-image

代码 from 图像 · 本页

2,16593只读MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Code From Image

Overview

This skill provides guidance for extracting code or pseudocode from images and implementing it correctly. It covers OCR tool selection, handling ambiguous text extraction, and verification strategies to ensure accurate implementation.

Workflow

Step 1: Environment Preparation

Before attempting to read an image, check available tools and packages:

  1. Check what package managers are available (pip, pip3, uv, conda)
  2. Check what image processing tools are installed (tesseract, pytesseract, PIL/Pillow)
  3. Install missing dependencies before proceeding

This avoids wasted attempts with unavailable tools.

Step 2: Image Analysis

Examine the image before OCR extraction:

  1. Use file <image> to verify the file type and ensure it's a valid image
  2. Open the image visually if possible to understand content structure
  3. Note the image quality, contrast, and text clarity

Step 3: OCR Extraction with Multiple Attempts

OCR is inherently error-prone. To maximize accuracy:

  1. First attempt: Use standard OCR (pytesseract with default settings)
  2. If output is garbled: Apply image preprocessing:

- Increase contrast - Convert to grayscale - Apply binarization (threshold) - Resize the image (2x or 3x upscaling can help)

  1. Compare outputs: If multiple OCR attempts yield different results, cross-reference them

Example preprocessing with PIL:

from PIL import Image, ImageEnhance, ImageFilter

img = Image.open("code.png")
# Convert to grayscale
img = img.convert("L")
# Increase contrast
enhancer = ImageEnhance.Contrast(img)
img = enhancer.enhance(2.0)
# Apply threshold for binarization
img = img.point(lambda x: 0 if x < 128 else 255, '1')
img.save("preprocessed.png")

Step 4: Interpreting OCR Output

OCR frequently produces character substitution errors. Document all interpretations explicitly:

Common OCR Misreadings:

  • 0 (zero) vs O (letter O) vs o (lowercase o)
  • 1 (one) vs l (lowercase L) vs I (uppercase i)
  • S vs 5 vs $
  • G vs 6
  • B vs 8
  • : vs ;
  • sha256 may appear as cha256 or sha2S6
  • Variable names may have incorrect characters (e.g., GALT instead of SALT)
  • Quote characters may be mangled (6" instead of b" for byte strings)
  • Array slicing may be garbled (h0[:10] appearing as hof:10])

Process for interpretation:

  1. List each unclear portion of the OCR output
  2. Document the most likely correct interpretation
  3. Explain reasoning for each interpretation
  4. Flag any interpretations with high uncertainty

Step 5: Implementation

When implementing the extracted code:

  1. Preserve the algorithm structure: Follow the logic as written, don't optimize prematurely
  2. Handle encoding explicitly: For cryptographic operations, be explicit about string vs bytes encoding
  3. Add basic error handling: Include try/except for file operations and external calls
  4. Log intermediate values: Print or log intermediate results for debugging

Step 6: Verification

Verify the implementation systematically:

  1. If a hint is provided (e.g., expected output prefix): Use it to validate, but don't rely on it exclusively
  2. Trace through the algorithm manually: Verify your understanding matches the implementation
  3. Test with known inputs: If possible, create test cases with predictable outputs
  4. Check edge cases: Empty inputs, special characters, boundary conditions

Warning: Using hints as the sole validation is brittle. A correct output prefix doesn't guarantee the algorithm is fully correct for all inputs.

Common Pitfalls

OCR-Related

  • Accepting first OCR output without verification: Always cross-check unclear characters
  • Not documenting assumptions: When interpreting garbled text, explicitly state what you're assuming
  • Skipping preprocessing: Image enhancement significantly improves OCR accuracy

Implementation-Related

  • String vs bytes confusion: In Python, cryptographic functions often require bytes (b"string") not strings
  • Missing imports: Ensure all required modules are imported before running
  • Silent failures: Add explicit error messages for file operations

Verification-Related

  • Over-relying on partial hints: A matching prefix doesn't mean the full output is correct
  • Not validating intermediate steps: Check values at each stage, not just the final output
  • Assuming OCR was correct: If output doesn't match expectations, revisit OCR interpretation

Fallback Strategy

If the initial interpretation produces incorrect results:

  1. Re-examine the original image, focusing on unclear characters
  2. Try alternative OCR preprocessing techniques
  3. List all ambiguous characters and test alternative interpretations systematically
  4. If multiple interpretations exist, implement and test each one

Example Workflow

For a task like "Extract pseudocode from image and compute hash":

  1. Check environment: which tesseract, pip3 list | grep -i pil
  2. Install if needed: pip3 install pillow pytesseract
  3. Analyze image: file code.png
  4. Extract text with OCR
  5. If garbled, preprocess image and retry OCR
  6. Document interpretations: "OCR shows GALT = 6"0000... - interpreting as SALT = b"0000..." because G/S confusion is common and 6" likely represents b" for bytes"
  7. Implement the algorithm
  8. Verify output against any provided hints
  9. If verification fails, revisit step 5-6 with alternative interpretations

平台分布

Claude Code

28.55%
按下载量换算217

Gemini CLI

23.62%
按下载量换算179

Codex

18.78%
按下载量换算143

Antigravity

12.54%
按下载量换算95

OpenCode

7.56%
按下载量换算57

windsurf

3.39%
按下载量换算26

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills