A responsive image-to-ASCII renderer with image, flowing ripple, and signal-glitch variations.
pnpm dlx shadcn@latest add @componentry/ascii-effect| Property | Type | Default |
|---|---|---|
imageSrcImage URL rendered as ASCII characters. | string | — |
variantVisual effect variation. | "image" | "flow" | "glitch" | "image" |
charsCharacters ordered from darkest to brightest. | string | " .:-=+*#%@" |
fontSizeCharacter height in pixels. | number | 9 |
fontFamilyFont stack used to draw the characters. | string | Arial, Helvetica, sans-serif |
fontWeightCanvas font weight. | number | string | 400 |
lineHeightCharacter row height multiplier. | number | 1 |
characterSpacingHorizontal character-cell spacing multiplier. | number | 1 |
brightnessBoostMultiplier applied to sampled image luminance. | number | 2.2 |
contrastContrast applied before character selection. | number | 1.1 |
thresholdDark-pixel cutoff used to keep the background clean. | number | 0.06 |
posterizeNumber of luminance steps. | number | 32 |
ditherDithering algorithm used to preserve photographic detail. | "none" | "floyd-steinberg" | "bayer" | "floyd-steinberg" |
ditherStrengthAmount of error diffusion or ordered dithering. | number | 0.8 |
flowSpeedFlow cycles per second for the flow variant. | number | 0.22 |
flowDirectionFlow direction in degrees. | number | 0 |
flowStrengthDirectional displacement in pixels. | number | 12 |
flowFrequencySize of the flowing wave field. | number | 0.018 |
mouseRadiusRadius of the pointer ripple in pixels. | number | 150 |
mouseStrengthPointer ripple displacement in pixels. | number | 22 |
mouseWaveSpeedSpeed of the pointer ripple. | number | 1.2 |
scaleImage zoom inside the ASCII field. | number | 1.15 |
fitHow the source image fits the canvas. | "cover" | "contain" | "stretch" | "cover" |
colorsOne or more colors used as a luminance gradient. | string[] | — |
colorModeUse a supplied gradient or colors sampled from the image. | "gradient" | "source" | "gradient" |
backgroundColorCanvas background color. | string | "#07090d" |
invertReverse the luminance-to-character mapping. | boolean | false |
glitchIntensityStrength and number of displaced signal bands. | number | 0.65 |
glitchFrequencyApproximate glitches per second. | number | 1.4 |
revealDurationRadial reveal duration in milliseconds. | number | 1400 |
altAccessible label for the canvas. | string | "ASCII rendering" |
classNameAdditional classes for the container. | string | — |
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.
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>