DocsASCII Effect

ASCII Effect

A responsive image-to-ASCII renderer with image, flowing ripple, and signal-glitch variations.

Installation

pnpm dlx shadcn@latest add @componentry/ascii-effect

Usage

API Reference

PropertyTypeDefault
imageSrc

Image URL rendered as ASCII characters.

string—
variant

Visual effect variation.

"image" | "flow" | "glitch""image"
chars

Characters ordered from darkest to brightest.

string" .:-=+*#%@"
fontSize

Character height in pixels.

number9
fontFamily

Font stack used to draw the characters.

stringArial, Helvetica, sans-serif
fontWeight

Canvas font weight.

number | string400
lineHeight

Character row height multiplier.

number1
characterSpacing

Horizontal character-cell spacing multiplier.

number1
brightnessBoost

Multiplier applied to sampled image luminance.

number2.2
contrast

Contrast applied before character selection.

number1.1
threshold

Dark-pixel cutoff used to keep the background clean.

number0.06
posterize

Number of luminance steps.

number32
dither

Dithering algorithm used to preserve photographic detail.

"none" | "floyd-steinberg" | "bayer""floyd-steinberg"
ditherStrength

Amount of error diffusion or ordered dithering.

number0.8
flowSpeed

Flow cycles per second for the flow variant.

number0.22
flowDirection

Flow direction in degrees.

number0
flowStrength

Directional displacement in pixels.

number12
flowFrequency

Size of the flowing wave field.

number0.018
mouseRadius

Radius of the pointer ripple in pixels.

number150
mouseStrength

Pointer ripple displacement in pixels.

number22
mouseWaveSpeed

Speed of the pointer ripple.

number1.2
scale

Image zoom inside the ASCII field.

number1.15
fit

How the source image fits the canvas.

"cover" | "contain" | "stretch""cover"
colors

One or more colors used as a luminance gradient.

string[]—
colorMode

Use a supplied gradient or colors sampled from the image.

"gradient" | "source""gradient"
backgroundColor

Canvas background color.

string"#07090d"
invert

Reverse the luminance-to-character mapping.

booleanfalse
glitchIntensity

Strength and number of displaced signal bands.

number0.65
glitchFrequency

Approximate glitches per second.

number1.4
revealDuration

Radial reveal duration in milliseconds.

number1400
alt

Accessible label for the canvas.

string"ASCII rendering"
className

Additional classes for the container.

string—

View source

Click the icon in the preview panel to browse source for each variant.

Keep in mind

This component is inspired by various open-source projects and patterns. Please verify licenses and implementation details before using in production.

Need a custom component?

I build bespoke UI components & websites tailored to your brand.

DM me on X
ImageRender / Live
import { AsciiEffect } from "@/components/ui/ascii-effect"
<div className="h-[520px] overflow-hidden rounded-2xl">
  <AsciiEffect
    variant="image"
    imageSrc="/images/portrait.jpg"
    fontSize={9}
    scale={1.15}
  />
</div>