agentsclimarketplace

Image to ascii

Skill vinsonconsulting/claude-skill-foundry/skills/ascii-art/image-to-ascii

A scoring harness for Claude Agent Skills. Each carded skill ships a Skill Card: a SkillSpector security scan and trigger evals, generated and gated in CI.

Install
npx -y skills add vinsonconsulting/claude-skill-foundry --skill image-to-ascii

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when converting an image file to ASCII art outside the browser — a command-line or script run that turns a photo, logo, screenshot, or render into text, saved as .txt or rendered to .png/.svg. Trigger on "make ASCII art of this image/photo/cat", "convert this picture/logo to ASCII", "turn this PNG into an ASCII text file for my README", batch-converting a folder of images to ASCII, or any Python/Pillow image-to-ASCII task. Produces sharp, shape-aware output by matching each cell to the glyph whose shape fits best (6D shape vectors + nearest-neighbour, optional contrast enhancement) rather than a naive brightness ramp, and bundles a monospace font for deterministic results. Runs scripts/image_to_ascii.py. Not for ASCII graphics on a web page or in React (use ascii-img-react), not the real-time textmode.js library (use textmode-js), and not figlet-style text banners (this converts images, not words).

SKILL.md

7.2 KB, as published. Nobody here has run it

image-to-ascii

Convert an image file to ASCII art from the command line — to stdout, a .txt file, or a rendered .png/.svg — using shape-aware glyph matching. The converter is scripts/image_to_ascii.py: Pillow-only, pure-Python, Python 3.9+.

Mental model

  • A naive ASCII converter picks one glyph per cell off a brightness ramp (" .:-=+*#%@"). That is nearest-neighbour downsampling — every cell is treated as a pixel, so edges come out jagged and curves look like staircases.
  • This converter instead reduces both each glyph and each image cell to a 6D shape vector (six staggered sampling circles in a 2×3 grid) and matches the glyph whose shape is closest. A diagonal edge picks / or \, a top bar picks "/^, a base picks _. Edges stay crisp because shape, not just average brightness, drives the choice.
  • Glyph vectors are computed by actually rasterizing the bundled font, so the match reflects the real ink — and png/svg output draws with that same font, so the rendered image is self-consistent with the text.
  • Polarity: by default dark pixels → dense glyphs (@, #), which looks right as text on a light background (a README, a .txt). For light-on-dark output (terminal style, e.g. white-on-black), add --invert.

For the full technique — circle geometry, the contrast-enhancement formulas, the luminance coefficients, caching — read references/technique.md.

Setup

The converter needs Pillow (nothing else):

python3 -m pip install Pillow

The monospace font ships in assets/DejaVuSansMono.ttf (with its license), so output is deterministic on any machine. No system fonts are required.

Usage

# Print 80-column ASCII to stdout
python3 scripts/image_to_ascii.py photo.jpg --cols 80

# Save a .txt for a README
python3 scripts/image_to_ascii.py logo.png --cols 100 --out logo.txt

# Render a PNG, white text on black (terminal look — note --invert for correct tones)
python3 scripts/image_to_ascii.py photo.jpg --cols 120 --invert \
  --format png --fg white --bg black --out photo.png

# Sharper edges on a high-contrast logo / 3D render
python3 scripts/image_to_ascii.py render.png --cols 100 --contrast 4 --directional

Run from the skill directory, or pass an absolute path to the script. Batch a folder with a shell loop over the files, reusing the same flags.

Flags

FlagDefaultWhat it does
--cols / --width80Output width in characters (rows follow from image aspect)
--contrast1.5Global contrast exponent (1 = off); separates light/dark
--directionaloffSample neighbours too, to sharpen hard edges (see below)
--directional-exp2.0Exponent for directional contrast
--invertoffMap bright pixels to dense glyphs (light-on-dark output)
--charsetprintable ASCII 32–126Glyph set to match against
--cell-aspectfrom font (~1.94)Character height/width; the default keeps the picture undistorted
--outstdoutOutput file (format inferred from extension)
--formattxt (or from --out)txt, png, or svg
--fg / --bg#000000 / transparentColors for png/svg (name or #hex)
--coloroff (mono)Colorize each cell with the image's average color
--fontbundled DejaVu Sans MonoOverride the .ttf
--font-size / --line-height14 / 1.0png/svg rendering size and line spacing

Choosing output and options

  • Plain text / READMEtxt (the default), default polarity. Keep --cols ≤ the width you can display; 80–120 is typical.
  • An image to embedpng. Use --invert --fg white --bg black for a terminal aesthetic, or default --fg dark on a light --bg for print.
  • Crisp, scalablesvg (vector, themeable later via the font-family).
  • Edges look mushy on a logo or 3D render → raise --contrast first (e.g. 4), then add --directional. Directional contrast mainly helps hard colour boundaries; on soft photos it can over-sharpen, so it is off by default.
  • --color writes ANSI escapes for txt to stdout (terminal only — saved .txt stays clean), and per-glyph colors for png/svg.

Boundary — when NOT to use this

  • Rendering an image as ASCII in a web page or React → use ascii-img-react.
  • A real-time, generative textmode/ASCII sketch (webcam, animation, WebGL) → use textmode-js.
  • A text banner of a word (figlet/toilet) → that draws letters from words; this converts pictures.

Attribution

The shape-vector technique is from Alex Harri's "ASCII characters are not pixels". The circle geometry and contrast math are ported from the MIT-licensed ascii-img-react package. The bundled font is DejaVu Sans Mono (license in assets/DejaVuSansMono-LICENSE.txt).

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.