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.
npx skills add https://github.com/curiositech/some_claude_skills --skill pixel-art-scaler
Deterministic algorithms for upscaling pixel art that preserve aesthetics by adding valid sub-pixels through edge detection and pattern matching.
✅ Use for:
❌ NOT for:
Best for: Quick iteration, 2x/3x scaling, transparent sprites
How it works:
When to use:
Timeline: Invented by Eric Johnston at LucasArts (~1992), rediscovered by Andrea Mazzoleni (2001)
Best for: Final renders, complex sprites, smooth gradients
How it works:
When to use:
Timeline: Developed by Maxim Stepin for emulators (2003)
Best for: Hero assets, promotional materials, detailed sprites
How it works:
When to use:
Timeline: xBR by Hyllian (2011), Super-xBR (2015)
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:
When nearest-neighbor IS correct: Viewing pixel art at exact integer multiples in pixel-perfect contexts (e.g., 1:1 reference images).
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 |
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!
# 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
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
compare_algorithms.py for side-by-sideAll 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:
--helpEPX: 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
All algorithms preserve alpha channel:
| 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
After scaling, verify results:
# 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:
/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/assets/test-sprites/ - Sample sprites for testing algorithms/assets/expected-outputs/ - Reference outputs for validationCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Improves the quality of images, especially screenshots, by enhancing resolution, sharpness, and clarity. Perfect for preparing images for presentations, documentation, or social media posts.
Downloads videos from YouTube and other platforms for offline viewing, editing, or archival. Handles various formats and quality options.
Lightweight WSI tile extraction and preprocessing. Use for basic slide processing tissue detection, tile extraction, stain normalization for H&E images. Best for simple pipelines, dataset preparation, quick tile-based analysis. For advanced spatial proteomics, multiplexed imaging, or deep learning pipelines use pathml.
Microscopy data management platform. Access images via Python, retrieve datasets, analyze pixels, manage ROIs/annotations, batch processing, for high-content screening and microscopy workflows.
Python library for working with DICOM (Digital Imaging and Communications in Medicine) files. Use this skill when reading, writing, or modifying medical imaging data in DICOM format, extracting pixel data from medical images (CT, MRI, X-ray, ultrasound), anonymizing DICOM files, working with DICOM metadata and tags, converting DICOM images to other formats, handling compressed DICOM data, or processing medical imaging datasets. Applies to tasks involving medical image analysis, PACS systems, radiology workflows, and healthcare imaging applications.
This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object detection, speech recognition, and fine-tuning models on custom datasets.
Take curiositech/pixel-art-scaler from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference pip.
Without those the skill loads but fails at the first command.