pixel-art-scaler
Deterministic pixel art upscaling using EPX/Scale2x, hq2x/hq4x, and xBR algorithms that add valid sub-pixels through pattern recognition. Activate on 'pixel art scaling', 'EPX', 'Scale2x', 'hq2x', 'hq4x', 'xBR', 'retro game upscaling'. NOT for AI/ML upscaling, photo enlargement, or simple nearest-neighbor.
Best use case
pixel-art-scaler is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Deterministic pixel art upscaling using EPX/Scale2x, hq2x/hq4x, and xBR algorithms that add valid sub-pixels through pattern recognition. Activate on 'pixel art scaling', 'EPX', 'Scale2x', 'hq2x', 'hq4x', 'xBR', 'retro game upscaling'. NOT for AI/ML upscaling, photo enlargement, or simple nearest-neighbor.
Teams using pixel-art-scaler should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/pixel-art-scaler/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How pixel-art-scaler Compares
| Feature / Agent | pixel-art-scaler | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Deterministic pixel art upscaling using EPX/Scale2x, hq2x/hq4x, and xBR algorithms that add valid sub-pixels through pattern recognition. Activate on 'pixel art scaling', 'EPX', 'Scale2x', 'hq2x', 'hq4x', 'xBR', 'retro game upscaling'. NOT for AI/ML upscaling, photo enlargement, or simple nearest-neighbor.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Pixel Art Scaler Deterministic algorithms for upscaling pixel art that preserve aesthetics by adding valid sub-pixels through edge detection and pattern matching. ## When to Use ✅ **Use for**: - Upscaling retro game sprites, icons, and pixel art - 2x, 3x, 4x scaling with edge-aware interpolation - Preserving sharp pixel art aesthetic at higher resolutions - Converting 8x8, 16x16, 32x32, 48x48 pixel art for retina displays - Comparing deterministic vs AI/ML approaches ❌ **NOT for**: - Photographs or realistic images (use AI super-resolution) - Simple geometric scaling (use nearest-neighbor) - Vector art (use SVG) - Text rendering (use font hinting) - Arbitrary non-integer scaling (algorithms work best at 2x, 3x, 4x) ## Core Algorithms ### 1. EPX/Scale2x (Fastest, Good Quality) **Best for**: Quick iteration, 2x/3x scaling, transparent sprites **How it works**: - Examines each pixel and its 4 cardinal neighbors (N, S, E, W) - Expands 1 pixel → 4 pixels (2x) or 9 pixels (3x) using edge detection - Only uses colors from original palette (no new colors) - Handles transparency correctly **When to use**: - Need fast processing (100+ icons) - Want crisp edges with no anti-aliasing - Source has clean pixel boundaries - Transparency preservation is critical **Timeline**: Invented by Eric Johnston at LucasArts (~1992), rediscovered by Andrea Mazzoleni (2001) ### 2. hq2x/hq3x/hq4x (High Quality, Slower) **Best for**: Final renders, complex sprites, smooth gradients **How it works**: - Pattern matching on 3x3 neighborhoods (256 possible patterns) - YUV color space thresholds for edge detection - Sophisticated interpolation rules per pattern - Produces smooth, anti-aliased edges **When to use**: - Final production assets - Source has gradients or dithering - Want smooth, anti-aliased results - Processing time is acceptable (~5-10x slower than EPX) **Timeline**: Developed by Maxim Stepin for emulators (2003) ### 3. xBR/Super-xBR (Highest Quality, Slowest) **Best for**: Hero assets, promotional materials, detailed sprites **How it works**: - Advanced edge detection with weighted blending - Multiple passes for smoother results (Super-xBR) - Preserves fine details while smoothing edges - Best anti-aliasing of the three algorithms **When to use**: - Maximum quality needed - Complex sprites with fine details - Marketing/promotional use - Time is not a constraint (~20x slower than EPX) **Timeline**: xBR by Hyllian (2011), Super-xBR (2015) ## Anti-Patterns ### Anti-Pattern: Nearest-Neighbor for Display **Novice thinking**: "Just use nearest-neighbor 4x, it preserves pixels" **Reality**: Nearest-neighbor creates blocky repetition without adding detail. Each pixel becomes NxN identical blocks, which looks crude on high-DPI displays. **What deterministic algorithms do**: Add valid sub-pixels through pattern recognition - a diagonal edge gets anti-aliased pixels, straight edges stay crisp. **Timeline**: - Pre-2000s: Nearest-neighbor was only option - 2001+: EPX/Scale2x enabled smart 2x scaling - 2003+: hq2x added sophisticated pattern matching - 2011+: xBR became state-of-the-art **When nearest-neighbor IS correct**: Viewing pixel art at exact integer multiples in pixel-perfect contexts (e.g., 1:1 reference images). ### Anti-Pattern: Using AI/ML for Pixel Art **Novice thinking**: "Real-ESRGAN / Waifu2x will give better results" **Reality**: AI models trained on photos/anime add inappropriate detail to pixel art. They invent textures and smooth edges that shouldn't exist, destroying the intentional pixel-level decisions. **LLM mistake**: Training data includes "upscaling = use AI models" advice from photo editing contexts. **Correct approach**: | Source Type | Algorithm | |-------------|-----------| | Pixel art (sprites, icons) | EPX/hq2x/xBR (this skill) | | Pixel art photos (screenshots) | Hybrid: xBR first, then light AI | | Photos/realistic art | AI super-resolution | | Mixed content | Test both, compare results | ### Anti-Pattern: Wrong Algorithm for Context **Novice thinking**: "Always use the highest quality algorithm" **Reality**: Different algorithms serve different purposes: | Context | Algorithm | Why | |---------|-----------|-----| | Iteration/prototyping | EPX | 10x faster, good enough | | Production assets (web) | hq2x | Balance of quality/size | | Hero images (marketing) | xBR | Maximum quality | | Transparent sprites | EPX | Best transparency handling | | Complex gradients | hq4x | Best gradient interpolation | **Validation**: Always compare outputs visually - sometimes EPX 2x looks better than hq4x! ## Usage ### Quick Start ```bash # Install dependencies cd ~/.claude/skills/pixel-art-scaler/scripts pip install Pillow numpy # Scale a single icon with EPX 2x (fastest) python3 scale_epx.py input.png output.png --scale 2 # Scale with hq2x (high quality) python3 scale_hqx.py input.png output.png --scale 2 # Scale with xBR (maximum quality) python3 scale_xbr.py input.png output.png --scale 2 # Batch process directory python3 batch_scale.py input_dir/ output_dir/ --algorithm epx --scale 2 # Compare all algorithms side-by-side python3 compare_algorithms.py input.png output_comparison.html ``` ### Algorithm Selection Guide **Decision tree**: ``` Need to scale pixel art? ├── Transparency important? → EPX ├── Fast iteration needed? → EPX ├── Complex gradients/dithering? → hq2x or hq4x ├── Maximum quality for hero asset? → xBR └── Not sure? → Run compare_algorithms.py ``` ### Typical Workflow 1. **Prototype with EPX 2x**: Process all assets quickly 2. **Review results**: Identify which need higher quality 3. **Re-process heroes with hq4x or xBR**: Apply to key assets only 4. **Compare outputs**: Use `compare_algorithms.py` for side-by-side 5. **Optimize**: Sometimes 2x looks better than 4x (test both) ## Scripts Reference All scripts in `scripts/` directory: | Script | Purpose | Speed | Quality | |--------|---------|-------|---------| | `scale_epx.py` | EPX/Scale2x implementation | Fast | Good | | `scale_hqx.py` | hq2x/hq3x/hq4x implementation | Medium | Great | | `scale_xbr.py` | xBR/Super-xBR implementation | Slow | Best | | `batch_scale.py` | Process directories | Varies | Varies | | `compare_algorithms.py` | Generate comparison HTML | N/A | N/A | Each script includes: - CLI interface with `--help` - Transparency preservation - Error handling for corrupted inputs - Progress indicators for batch operations ## Technical Details ### Color Space Considerations **EPX**: Works in RGB, binary edge detection **hq2x/hq4x**: Uses YUV color space with thresholds (Y=48, Cb=7, Cr=6) **xBR**: Advanced edge weighting in RGB with luminance consideration ### Transparency Handling All algorithms preserve alpha channel: - Transparent pixels don't influence edge detection - Semi-transparent pixels are handled correctly - Output maintains RGBA format if input has alpha ### Performance Benchmarks (M4 Max, 48x48 input) | Algorithm | Time (1 image) | Batch (100 images) | |-----------|----------------|---------------------| | EPX 2x | 0.01s | 1s | | EPX 3x | 0.02s | 2s | | hq2x | 0.10s | 10s | | hq4x | 0.30s | 30s | | xBR 2x | 0.15s | 15s | | xBR 4x | 0.50s | 50s | **Rule of thumb**: EPX is ~10x faster than hq2x, ~20x faster than xBR ## Output Validation After scaling, verify results: ```bash # Check output dimensions identify output.png # Should be exactly 2x, 3x, or 4x input # Visual inspection open output.png # Look for artifacts, incorrect edges # Compare algorithms python3 compare_algorithms.py input.png comparison.html open comparison.html # Side-by-side comparison ``` **Common issues**: - Jagged diagonals → Try hq2x or xBR instead of EPX - Blurry edges → Check if input was already scaled (apply to original) - Wrong colors → Verify input is RGB/RGBA (not indexed/paletted PNG) ## References ### Deep Dives - `/references/algorithm-comparison.md` - Visual examples and trade-offs - `/references/epx-algorithm.md` - EPX/Scale2x implementation details - `/references/hqx-patterns.md` - hq2x pattern matching table explanation - `/references/xbr-edge-detection.md` - xBR edge weighting formulas ### Research Papers & Sources - [Pixel-art scaling algorithms - Wikipedia](https://en.wikipedia.org/wiki/Pixel-art_scaling_algorithms) - [Scale2x & EPX official site](https://www.scale2x.it/scale2xandepx) - [hqx: An Image Scaling Algorithm for Pixel Art](https://every-algorithm.github.io/2024/10/30/hqx.html) - [py-super-xbr GitHub](https://github.com/n0spaces/py-super-xbr) ### Example Assets - `/assets/test-sprites/` - Sample sprites for testing algorithms - `/assets/expected-outputs/` - Reference outputs for validation ## Changelog - 2026-02-05: Initial skill creation with EPX, hq2x, xBR implementations
Related Skills
win31-pixel-art-designer
Expert in Windows 3.1 era pixel art and graphics. Creates icons, banners, splash screens, and UI assets with authentic 16/256-color palettes, dithering patterns, and Program Manager styling. Activate on 'win31 icons', 'pixel art 90s', 'retro icons', '16-color', 'dithering', 'program manager icons', 'VGA palette'. NOT for modern flat icons, vaporwave art, or high-res illustrations.
pixel-art-infographic-creator
Generate pixel art diagrams and infographics in retro 16-bit SNES aesthetic — recovery education visuals, flowcharts, data visualizations, process diagrams with dithering and limited palettes. NOT for photo-realistic images, vector graphics, or high-resolution illustration.
skill-coach
Guides creation of high-quality Agent Skills with domain expertise, anti-pattern detection, and progressive disclosure best practices. Use when creating skills, reviewing existing skills, or when users mention improving skill quality, encoding expertise, or avoiding common AI tooling mistakes. Activate on keywords: create skill, review skill, skill quality, skill best practices, skill anti-patterns. NOT for general coding advice or non-skill Claude Code features.
3d-cv-labeling-2026
Expert in 3D computer vision labeling tools, workflows, and AI-assisted annotation for LiDAR, point clouds, and sensor fusion. Covers SAM4D/Point-SAM, human-in-the-loop architectures, and vertical-specific training strategies. Activate on '3D labeling', 'point cloud annotation', 'LiDAR labeling', 'SAM 3D', 'SAM4D', 'sensor fusion annotation', '3D bounding box', 'semantic segmentation point cloud'. NOT for 2D image labeling (use clip-aware-embeddings), general ML training (use ml-engineer), video annotation without 3D (use computer-vision-pipeline), or VLM prompt engineering (use prompt-engineer).
wisdom-accountability-coach
Longitudinal memory tracking, philosophy teaching, and personal accountability with compassion. Expert in pattern recognition, Stoicism/Buddhism, and growth guidance. Activate on 'accountability', 'philosophy', 'Stoicism', 'Buddhism', 'personal growth', 'commitment tracking', 'wisdom teaching'. NOT for therapy or mental health treatment (refer to professionals), crisis intervention, or replacing professional coaching credentials.
windows-95-web-designer
Modern web applications with authentic Windows 95 aesthetic. Gradient title bars, Start menu paradigm, taskbar patterns, 3D beveled chrome. Extrapolates Win95 to AI chatbots, mobile UIs, responsive layouts. Activate on 'windows 95', 'win95', 'start menu', 'taskbar', 'retro desktop', '95 aesthetic', 'clippy'. NOT for Windows 3.1 (use windows-3-1-web-designer), vaporwave/synthwave, macOS, flat design.
windows-3-1-web-designer
Modern web applications with authentic Windows 3.1 aesthetic. Solid navy title bars, Program Manager navigation, beveled borders, single window controls. Extrapolates Win31 to AI chatbots (Cue Card paradigm), mobile UIs (pocket computing). Activate on 'windows 3.1', 'win31', 'program manager', 'retro desktop', '90s aesthetic', 'beveled'. NOT for Windows 95 (use windows-95-web-designer - has gradients, Start menu), vaporwave/synthwave, macOS, flat design.
win31-audio-design
Expert in Windows 3.1 era sound vocabulary for modern web/mobile apps. Creates satisfying retro UI sounds using CC-licensed 8-bit audio, Web Audio API, and haptic coordination. Activate on 'win31 sounds', 'retro audio', '90s sound effects', 'chimes', 'tada', 'ding', 'satisfying UI sounds'. NOT for modern flat UI sounds, voice synthesis, or music composition.
wedding-immortalist
Transform thousands of wedding photos and hours of footage into an immersive 3D Gaussian Splatting experience with theatre mode replay, face-clustered guest roster, and AI-curated best photos per person. Expert in 3DGS pipelines, face clustering, aesthetic scoring, and adaptive design matching the couple's wedding theme (disco, rustic, modern, LGBTQ+ celebrations). Activate on "wedding photos", "wedding video", "3D wedding", "Gaussian Splatting wedding", "wedding memory", "wedding immortalize", "face clustering wedding", "best wedding photos". NOT for general photo editing (use native-app-designer), non-wedding 3DGS (use drone-inspection-specialist), or event planning (not a wedding planner).
websocket-streaming
Implements real-time bidirectional communication between DAG execution engines and visualization dashboards via WebSocket. Covers connection management, typed event protocols, reconnection with backoff, and React hook integration. Activate on "WebSocket", "real-time updates", "live streaming", "execution events", "state streaming", "push notifications". NOT for HTTP REST APIs, server-sent events (SSE), or general networking.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs. Activate on: Playwright, webapp testing, browser automation, E2E testing, UI testing. NOT for API-only testing without browser, unit tests, or mobile app testing.
web-weather-creator
Master of stylized atmospheric effects using SVG filters and CSS animations. Creates clouds, waves, lightning, rain, fog, aurora borealis, god rays, lens flares, twilight skies, and ocean spray—all with a premium aesthetic that's stylized but never cheap-looking.