Generate styled QR codes (SVG/PNG/JPG) with custom colors, shapes, and error correction. Agent should display generated files. Secure: all outputs saved to workspace root.
INLINECODE11 - Quiet zone size (default: 4, max: 100)
Styling
- --dot <square|circle> - Data module shape (default: square)
INLINECODE16 - Finder pattern style (default: square)
INLINECODE18 - Foreground color (default: #000000)
INLINECODE20 - Background color (default: #ffffff)
INLINECODE22 - Transparent background (PNG only, ignored for SVG/JPG)
Quality
- --ec <L|M|Q|H> - Error correction: Low/Medium/Quality/High (default: M)
- L (~7%): Clean environments, maximum data capacity
- M (~15%): General use, balanced capacity/reliability
- Q (~25%): Styled QR codes, moderate damage tolerance
- H (~30%): Logo embedding, heavy styling, outdoor use
Platform notes: macOS requires Xcode Command Line Tools. See sharp docs for other platforms.
Examples
WiFi QR Code
CODEBLOCK2
Styled Business Card
CODEBLOCK3
High-Resolution Print
CODEBLOCK4
Transparent Logo Overlay
CODEBLOCK5
Logo Embedding (Requires High Error Correction)
CODEBLOCK6
Security Features
- ✅ Path traversal protection - All outputs forced to workspace root
✅ Symlink attack prevention - Atomic writes with verification
✅ Input validation - Length limits (4096 chars), character whitelisting
✅ Filename sanitization - Dangerous characters stripped from filenames
✅ Resource limits - Max size/scale to prevent DoS attacks
Troubleshooting
Issue
Solution
INLINECODE31 fails
Install build tools:xcode-select --install (macOS) or see sharp install guide
QR code won't scan
Increase --size, use higher error correction (--ec H), or simplify styling |
| Colors not working | Use hex format #RRGGBB (e.g., #FF5733), not RGB or color names |
| File too large | Reduce --size, --scale, or increase --quality for JPG |
| Permission denied | Check workspace directory write permissions |
Error Correction Levels Explained
Error correction allows QR codes to remain scannable even when partially damaged or obscured:
Level
Recovery Capacity
Data Capacity
Use Case
INLINECODE40
~7% damage
Maximum
Clean environments, screen display, maximum data
INLINECODE41
~15% damage | High | General use (default), standard printing |
| Q | ~25% damage | Medium | Styled designs (circles/rounded), possible minor damage |
| H | ~30% damage | Minimum | Logo embedding, outdoor use, heavy styling, print-on-print |
Key principle: Higher error correction = more damage tolerance but less data capacity.