Screenshot to Code — Convert Designs to Code
Screenshot to Code converts screenshots, mockups, and Figma designs into clean code using AI. 72.1K+ GitHub stars. HTML, React, Vue, Bootstrap. MIT.
这个资产会安全暂存
这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。
npx -y tokrepo@latest install e8c64554-d3b8-402d-b5c7-74bce0b57159 --target codex先暂存文件;激活前需要读取暂存 README 和安装计划。
What it is
Screenshot to Code is an open-source tool that converts screenshots, mockups, and Figma designs into clean, functional code. It uses AI vision models to interpret visual layouts and generate HTML, React, Vue, or Bootstrap code that reproduces the design.
The tool targets developers and designers who want to accelerate the design-to-code workflow. Instead of manually coding a layout from a mockup, upload a screenshot and get working code in seconds.
How it saves time or tokens
Manually converting a design mockup to code takes hours of measuring spacing, matching colors, and writing responsive CSS. Screenshot to Code automates this translation, producing a working first draft that developers can refine.
The generated code uses standard HTML and CSS rather than proprietary components, making it easy for AI coding assistants to further modify and extend.
How to use
- Clone and run the application:
git clone https://github.com/abi/screenshot-to-code.git
cd screenshot-to-code
pip install -r requirements.txt
cd frontend && npm install && npm run dev
- Open the web UI and upload a screenshot or paste a URL.
- Select the output format (HTML/CSS, React, Vue, Bootstrap).
- The AI analyzes the visual layout and generates code that reproduces the design.
- Copy the generated code and integrate it into your project.
Example
<!-- Generated from a landing page screenshot -->
<section style='display: flex; flex-direction: column; align-items: center; padding: 4rem 2rem;'>
<h1 style='font-size: 2.5rem; font-weight: 700; margin-bottom: 1rem;'>Build Faster with AI</h1>
<p style='font-size: 1.2rem; color: #666; max-width: 600px; text-align: center;'>Convert any design into production-ready code in seconds.</p>
<button style='margin-top: 2rem; padding: 0.75rem 2rem; background: #2563eb; color: white; border-radius: 8px; border: none;'>Get Started</button>
</section>
Related on TokRepo
- AI Tools for Design — AI-powered design tools and converters
- AI Tools for Coding — AI code generation from various inputs
Common pitfalls
- Expecting pixel-perfect output. AI vision models approximate layouts. The generated code is a starting point, not a finished product. Plan for manual refinement of spacing, fonts, and responsive behavior.
- Using low-resolution screenshots. Higher resolution inputs produce better results. Crop tightly to the area you want converted.
- Not specifying the output framework. The default HTML output may not match your project stack. Select React or Vue if that is what your project uses.
- Failing to review community discussions and changelogs before upgrading. Breaking changes in major versions can disrupt existing workflows. Pin versions in production and test upgrades in staging first.
常见问题
Screenshot to Code produces a reasonable approximation of the input design. Simple layouts with clear structure convert well. Complex designs with overlapping elements, custom fonts, or animations require manual adjustment after generation.
Screenshot to Code supports multiple vision-capable models including GPT-4o, Claude, and Gemini. The model interprets the visual layout and generates code. You need an API key for your chosen model provider.
Screenshot to Code works with screenshots of Figma designs. For direct Figma integration, export your design as an image and upload it. Some workflows also support pasting Figma URLs for automatic screenshot capture.
Screenshot to Code generates HTML/CSS, React (JSX), Vue, and Bootstrap code. The output uses standard web technologies without proprietary dependencies, making it easy to integrate into any project.
The tool is open-source under the MIT license and free to self-host. You pay for the AI model API calls (OpenAI, Anthropic, or Google). A hosted version is also available for users who prefer not to run it locally.
引用来源 (3)
- Screenshot to Code GitHub— Screenshot to Code converts designs to HTML, React, Vue, and Bootstrap code
- OpenAI Documentation— GPT-4 Vision capabilities for image understanding
- Anthropic Documentation— Claude vision model for multimodal understanding
来源与感谢
abi/screenshot-to-code — 72,100+ GitHub stars
讨论
相关资产
MarkItDown — Convert Any Document to Markdown
Microsoft's Python tool to convert Office docs, PDFs, images, audio, and HTML to clean Markdown for LLM pipelines. Also available as MCP server.
Foam — Personal Knowledge Management System for VS Code
Foam is a free, open-source personal knowledge management tool that runs inside VS Code. Inspired by Roam Research, it uses wikilinks, backlinks, and a graph visualization to help you organize interconnected notes in plain Markdown files.
CodeGeeX — Open Multilingual Code Generation Model
An open-source AI model for code generation, completion, and translation across 20+ programming languages, with IDE extensions for VS Code and JetBrains.
Marker — Convert PDF to Markdown with High Accuracy
Fast, accurate PDF to Markdown + JSON converter. Handles tables, images, equations, code blocks, and multi-column layouts. GPU-accelerated. 33K+ GitHub stars.