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

PropTypeDefault
imageSrcstring

Image URL rendered as ASCII characters.

—
variant"image" | "flow" | "glitch"

Visual effect variation.

"image"
charsstring

Characters ordered from darkest to brightest.

" .:-=+*#%@"
fontSizenumber

Character height in pixels.

9
fontFamilystring

Font stack used to draw the characters.

Arial, Helvetica, sans-serif
fontWeightnumber | string

Canvas font weight.

400
lineHeightnumber

Character row height multiplier.

1
characterSpacingnumber

Horizontal character-cell spacing multiplier.

1
brightnessBoostnumber

Multiplier applied to sampled image luminance.

2.2
contrastnumber

Contrast applied before character selection.

1.1
thresholdnumber

Dark-pixel cutoff used to keep the background clean.

0.06
posterizenumber

Number of luminance steps.

32
dither"none" | "floyd-steinberg" | "bayer"

Dithering algorithm used to preserve photographic detail.

"floyd-steinberg"
ditherStrengthnumber

Amount of error diffusion or ordered dithering.

0.8
flowSpeednumber

Flow cycles per second for the flow variant.

0.22
flowDirectionnumber

Flow direction in degrees.

0
flowStrengthnumber

Directional displacement in pixels.

12
flowFrequencynumber

Size of the flowing wave field.

0.018
mouseRadiusnumber

Radius of the pointer ripple in pixels.

150
mouseStrengthnumber

Pointer ripple displacement in pixels.

22
mouseWaveSpeednumber

Speed of the pointer ripple.

1.2
scalenumber

Image zoom inside the ASCII field.

1.15
fit"cover" | "contain" | "stretch"

How the source image fits the canvas.

"cover"
colorsstring[]

One or more colors used as a luminance gradient.

—
colorMode"gradient" | "source"

Use a supplied gradient or colors sampled from the image.

"gradient"
backgroundColorstring

Canvas background color.

"#07090d"
invertboolean

Reverse the luminance-to-character mapping.

false
glitchIntensitynumber

Strength and number of displaced signal bands.

0.65
glitchFrequencynumber

Approximate glitches per second.

1.4
revealDurationnumber

Radial reveal duration in milliseconds.

1400
altstring

Accessible label for the canvas.

"ASCII rendering"
classNamestring

Additional classes for the container.

—

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
PreviousRipple Transition
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>