Skip to content
Magic UI SolidMagicUI Solid

Pixel Image

A component that displays your image with a pixelated effect, enhancing the visual appeal of any image in your website.

Pixel image piece 1
Pixel image piece 2
Pixel image piece 3
Pixel image piece 4
Pixel image piece 5
Pixel image piece 6
Pixel image piece 7
Pixel image piece 8
Pixel image piece 9
Pixel image piece 10
Pixel image piece 11
Pixel image piece 12
Pixel image piece 13
Pixel image piece 14
Pixel image piece 15
Pixel image piece 16
Pixel image piece 17
Pixel image piece 18
Pixel image piece 19
Pixel image piece 20
Pixel image piece 21
Pixel image piece 22
Pixel image piece 23
Pixel image piece 24
@/demos/PixelImageDemo.tsx
import { PixelImage } from '@/registry/magicui/pixel-image'
export function PixelImageDemo() {
return (
<PixelImage
src={`${import.meta.env.BASE_URL}pixel-image-demo.jpg`}
customGrid={{ rows: 4, cols: 6 }}
grayscaleAnimation
/>
)
}
  • Pixelated image reveal animation
  • Customizable grid size and layout
  • Supports grayscale-to-color animation
  • Adjustable animation duration and delay
  • Lightweight and easy to use
Terminal window
pnpm dlx shadcn@latest add @magicui-solid/pixel-image
import { PixelImage } from '@/components/magicui/pixel-image'
<PixelImage src={`${import.meta.env.BASE_URL}pixel-image-demo.jpg`} grid="8x8" />
Prop Type Default Description
src string - The image source URL
grid "6x4"/"8x8"/"8x3"/"4x6"/"3x8" "8x8" Predefined grid layout
customGrid { rows: number, cols: number } - Custom grid layout (overrides grid)
grayscaleAnimation boolean true Whether to animate from grayscale to color
pixelFadeInDuration number 1000 Duration (ms) for each pixel fade-in animation
maxAnimationDelay number 1200 Maximum random delay (ms) for pixel animation
colorRevealDelay number 1500 Delay (ms) before revealing color
// Predefined grid options
"6x4" | "8x8" | "8x3" | "4x6" | "3x8"
// Custom grid example
customGrid={{ rows: 5, cols: 10 }}
  • Since the pixelation effect is purely decorative, make sure to provide text alternatives (like descriptions or labels) for any important content shown in the image. This ensures the content is accessible to screen reader users.

Original:

magicui.design/docs/components/pixel-image