agentleFS
ckorhonenckorhonen/claude-skills/skills/ascii-pixel-art/SKILL.md

ascii-pixel-art

Skill17 starsChanged 4 months agoMITView on GitHub

Generate animated ASCII art from images with subject detection, blurred pixelated backgrounds, and dynamic visual effects. Use when asked to create ASCII art, convert an image to ASCII, generate pixel art, add animated text art effects, or make retro-style visual art from photos.

  • Installs packages

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Choppy animation: Check browser hardware acceleration

    line 178

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ASCII Pixel Art Generator

Generate animated ASCII art from images with subject detection, blurred pixelated backgrounds, and dynamic visual effects.

Description

Transform images into interactive ASCII art with sophisticated visual effects. Uses computer vision to detect subjects, creates atmospheric backgrounds, and adds cinematic animations including pulse effects, diagonal sweeps, random flickers, and interactive hover responses.

When to Use

✅ Use when:

  • Creating artistic visualizations of photos or portraits
  • Generating retro/cyberpunk aesthetic content
  • Building interactive web art pieces
  • Converting images to animated HTML displays
  • Creating unique social media content
  • Demonstrating creative coding techniques

❌ Do NOT use when:

  • Simple text-based ASCII art is sufficient
  • Performance is critical (heavy processing required)
  • Accessibility is paramount (relies on visual effects)
  • Source image has no clear subject (works best with portraits/objects)
  • Output needs to be static (this generates animated HTML)

Prerequisites

Required packages:

pip install pillow rembg numpy

System requirements:

  • Python 3.7+
  • ~500MB RAM for image processing
  • rembg model downloads automatically (~180MB)

Usage

Basic Command

python3 scripts/ascii_pixel_effect.py <input_image> [output.html]

Examples

# Generate with default output name
python3 scripts/ascii_pixel_effect.py portrait.jpg

# Specify output file
python3 scripts/ascii_pixel_effect.py photo.png artwork.html

# Process multiple images
for img in *.jpg; do
  python3 scripts/ascii_pixel_effect.py "$img" "${img%.jpg}.html"
done

How It Works

7-Step Pipeline

1. Load and Resize

  • Opens image, converts to RGB
  • Resizes to 900px width (maintains aspect ratio)
  • Uses LANCZOS filter for high-quality downscaling

2. Build Blurred Background

  • Applies Gaussian blur (radius=14)
  • Darkens by 35% (multiply by 0.65)
  • Desaturates 50% (blend with luminance grayscale)
  • Pixelates using BOX filter downscale + NEAREST upscale
  • Creates atmospheric base layer

3. Subject Detection

  • Runs rembg to generate alpha mask
  • Threshold: mask mean > 0.25 for subject detection
  • Critical: Uses mask ONLY (no luminance supplement)
  • Prevents bright backgrounds from getting ASCII chars

4. Pixel Grid Overlay

  • White boxes at 24px intervals
  • 5% opacity for subtle cyberpunk aesthetic
  • Applied only to subject cells
  • Static layer (drawn once)

5. Build Character Grid

  • Cell size: 11×14 pixels
  • Samples average RGB and luminance per cell
  • Subject cells: ASCII char from density ramp, normalized color
  • Background cells: . character in dark blue (40, 65, 100)
  • ASCII ramp: @#S08Xox+=;:-,. (inverted luminance)

6. Composite Layers

  • Layer 1: Blurred background (base64 embedded)
  • Layer 2: Pixel grid canvas
  • Layer 3: ASCII character canvas
  • Single wrapper div stretches all layers to match

7. Animate (JavaScript)

  • Sine wave pulse: Bright subject cells oscillate
  • Diagonal shine: Sweeping highlight effect
  • Random flicker: 0.25% chance per cell, 2-8 frame duration
  • Hover ripple: Interactive cyan glow within 8 cells
  • Character scatter: Random chars on hover within 2 cells
  • Dynamic glow: shadowBlur scales with luminance and pulse
  • Background dots: Static 30% opacity

Parameters

ParameterValuePurpose
TARGET_WIDTH900pxOutput image width
CELL_W × CELL_H11×14pxCharacter cell dimensions
GRID_STEP24pxPixel grid interval
Blur radius14Background blur strength
BG darken0.65Background darkening (35% darker)
BG desaturate50%Background color reduction
Subject threshold0.25Mask mean for subject detection
ASCII ramp@#S08Xox+=;:-,. Density gradient (dark→light)
BG dot color(40, 65, 100)Background character RGB
BG dot opacity30%Background character transparency
Grid opacity5%Pixel grid visibility

Color Formula

def normalize_color(r, g, b):
    """Preserve hue, maximize brightness"""
    mx = max(r, g, b, 1)
    return int(r/mx*255), int(g/mx*255), int(b/mx*255)

This normalizes RGB values so the brightest channel reaches 255, preserving hue while maximizing color saturation for subject pixels.

Output

Self-contained HTML file:

  • No external dependencies
  • Background image base64-encoded
  • Inline CSS and JavaScript
  • Opens directly in browser
  • Interactive hover effects
  • ~500KB-2MB depending on image size

Visual effects:

  • 60fps animations
  • Responsive to mouse movement
  • Cinematic lighting and glow
  • Cyberpunk/retro aesthetic

Tips & Best Practices

Image Selection:

  • Best: Portraits, people, distinct objects
  • Good: Product photos, artwork with clear subjects
  • Avoid: Landscapes, abstract patterns, busy backgrounds

Performance:

  • Processing time: 5-15 seconds per image
  • Output size: ~1-2MB HTML
  • Browser performance: Excellent (canvas-based)

Artistic Control:

  • Darker source images → more dramatic contrast
  • High-contrast subjects → better edge definition
  • Clean backgrounds → cleaner dot matrix
  • Centered subjects → better visual balance

Common Issues:

  • Subject not detected: Try images with clearer foreground/background separation
  • Too bright: Source image may need adjustment
  • Choppy animation: Check browser hardware acceleration

Related Variants

  • v2 (Gray BG): Alternative with neutral gray background instead of pixelated blur
  • See skills/ascii-pixel-effect-v2/SKILL.md for implementation

References

  • Original implementation: March 2026
  • Taught by: Sensei
  • Inspired by: Classic ASCII art + modern web animations
  • Technique: Computer vision + generative art

License

MIT License - Free to use and modify

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.