制作扫得出来的二维码:纠错等级、印刷尺寸与条形码
传单、名片、菜单、包装上到处都是二维码,但印出来手机却很难扫的情况出奇地常见。下面介绍如何制作一扫就能识别的二维码。
QR 码于 1994 年由日本电装公司(Denso Wave)为追踪汽车零件而开发,并以 ISO/IEC 18004 标准化。角上的三个大方块(定位图形)让扫描器可以从任何角度快速读取。
二维码的结构、如何选择纠错等级(L、M、Q、H)、最小印刷尺寸与静区、扫码失败的原因,以及二维码与商品条形码的区别。阅读指南 →
将网址、联系方式或任意文本制作成可用手机扫码打开的二维码图片。适合用于印制名片、海报或宣传单。
不会!生成的静态二维码永久有效,不会失效。
用于印刷品时,建议尺寸在 300x300 像素以上最为清晰。
是的,主流 iPhone 和安卓手机的自带相机均可直接扫码。
传单、名片、菜单、包装上到处都是二维码,但印出来手机却很难扫的情况出奇地常见。下面介绍如何制作一扫就能识别的二维码。
QR 码于 1994 年由日本电装公司(Denso Wave)为追踪汽车零件而开发,并以 ISO/IEC 18004 标准化。角上的三个大方块(定位图形)让扫描器可以从任何角度快速读取。
二维码的结构、如何选择纠错等级(L、M、Q、H)、最小印刷尺寸与静区、扫码失败的原因,以及二维码与商品条形码的区别。阅读指南 →
想要自己的版本?把下面的任务提示词粘贴到 AI 聊天中,或将技能文件保存到 AI 编程助手。其中包含我们开发此工具时整理的功能、边界情况和测试用例。
提示词和技能以英文提供,AI 工具在任何语言环境下都能很好地理解。
直接粘贴到 Claude、ChatGPT、Gemini 等 AI 聊天中即可。
You are an experienced full-stack web developer. Build a web tool called "二维码生成器" that meets the requirements below.
## Goal
Build a tool that creates print-ready QR codes from text, URLs, Wi-Fi details and more.
## Core features
- Types: URL, text, Wi-Fi, contact (vCard)
- Error correction level L/M/Q/H
- Size, quiet zone and colour settings
- Download PNG and SVG
- Optional centre logo (level H recommended)
## Inputs
- Content and type
- Error level, size, colours, logo
## Outputs
- QR preview
- PNG/SVG files
## Edge cases and handling rules
- Warn about low contrast between modules and background
- Explain capacity errors and how to shorten content
- Escape special characters (; ,) in Wi-Fi strings
- Warn when the quiet zone is under four modules
## Implementation requirements
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.
## Definition of done (test cases)
- 'https://example.com' decodes back to the same text with a scanner library
- Level H uses at least as many modules as level L
- SVG stays sharp when scaled
First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.
在 Claude Code 等 AI 编程助手中保存为 .claude/skills/build-qr-code-generator/SKILL.md,以后开发或修改此工具时可重复使用。
---
name: build-qr-code-generator
description: Use when building or changing a 二维码生成器 tool. Build a tool that creates print-ready QR codes from text, URLs, Wi-Fi details and more.
---
# Build: 二维码生成器
## Goal
Build a tool that creates print-ready QR codes from text, URLs, Wi-Fi details and more.
## Workflow
1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.
## Core features
- Types: URL, text, Wi-Fi, contact (vCard)
- Error correction level L/M/Q/H
- Size, quiet zone and colour settings
- Download PNG and SVG
- Optional centre logo (level H recommended)
## Inputs
- Content and type
- Error level, size, colours, logo
## Outputs
- QR preview
- PNG/SVG files
## Rules
- Warn about low contrast between modules and background
- Explain capacity errors and how to shorten content
- Escape special characters (; ,) in Wi-Fi strings
- Warn when the quiet zone is under four modules
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
## Verification
- [ ] 'https://example.com' decodes back to the same text with a scanner library
- [ ] Level H uses at least as many modules as level L
- [ ] SVG stays sharp when scaled