Pixelate

Apply pixelate or mosaic effect to images. Creates retro 8-bit/16-bit gaming style, protects privacy by obscuring faces or text, or adds artistic blocky effects.

Installation

To install the Image plugin:

Terminal
$ npm install -g @mediaproc/image

Usage

Terminal
$ mediaproc image pixelate <input> [options]

Basic Usage

Terminal
$ mediaproc image pixelate photo.jpg
✓ Pixelated with 10px blocks
$ mediaproc image pixelate image.png --pixels 20
$ mediaproc image pixelate photo.jpg -p 5
$ mediaproc image pixelate face.jpg --pixels 30
$ mediaproc image pixelate game.jpg -p 8 -o retro.jpg

Options

OptionAliasTypeDefaultDescription
--pixels <size>-pnumber10Pixel block size (2-50) - larger = more pixelated
--output <path>-ostring<input>-pixelated.<ext>Output file path
--dry-runbooleanfalsePreview without making changes
--verbose-vbooleanfalseShow detailed output
--helpbooleanfalseDisplay help information

How It Works

The pixelate effect works by:

  • Shrinking: Image reduced by pixel size factor
  • Enlarging: Resized back to original using nearest neighbor interpolation
  • Result: Blocky, pixelated appearance

Example Process

Original: 1000x1000px with 10px blocks

  • Shrink to 100x100px (1000 ÷ 10)
  • Enlarge to 1000x1000px (nearest neighbor)
  • Result: 10x10px blocks across image

Pixel Size Guide

Subtle Pixelation (2-5)

  • Effect: Slight pixelation, retains most detail
  • Use: Artistic touch, mild privacy
  • Example: --pixels 3

Retro Gaming (8-12)

  • Effect: Classic 8-bit/16-bit game style
  • Use: Retro aesthetics, gaming content
  • Example: --pixels 8 (8-bit) or --pixels 12 (16-bit)

Strong Effect (15-25)

  • Effect: Heavy pixelation, significant detail loss
  • Use: Privacy protection, strong stylization
  • Example: --pixels 20

Extreme Pixelation (30-50)

  • Effect: Very blocky, minimal detail
  • Use: Heavy censorship, extreme artistic effect
  • Example: --pixels 40

Examples

Default Pixelation

Apply moderate pixelation:

mediaproc image pixelate photo.jpg

Result: 10x10px blocks (default size).

Retro Eight-Bit Style

Classic 8-bit gaming aesthetic:

mediaproc image pixelate game-sprite.png --pixels 8

Perfect for: Retro game graphics, pixel art style.

Privacy Protection

Blur faces or sensitive information:

mediaproc image pixelate document.jpg --pixels 20 -o censored.jpg

Privacy: Obscures text, faces, or sensitive data.

Subtle Artistic Effect

Light pixelation for artistic touch:

mediaproc image pixelate portrait.jpg -p 5

Artistic: Retains detail while adding pixelated aesthetic.

Heavy Censorship

Extreme pixelation for redaction:

mediaproc image pixelate sensitive.png --pixels 40

Censorship: Complete obscuration of content.

Console Gaming Style (Sixteen-Bit)

Classic console gaming look:

mediaproc image pixelate character.png -p 12 -o retro-16bit.png

Retro: 16-bit console era style.

Batch Processing

Pixelate multiple images:

mediaproc image pixelate "photos/*.jpg" --pixels 10

Batch: All images get same pixel size.

Custom Output Path

Save to specific location:

mediaproc image pixelate photo.jpg -p 15 -o output/pixel-art.jpg

Organization: Custom output directory.

Different Pixel Sizes

Compare effects:

# Subtle
mediaproc image pixelate photo.jpg -p 5 -o subtle.jpg

# Medium
mediaproc image pixelate photo.jpg -p 10 -o medium.jpg

# Strong
mediaproc image pixelate photo.jpg -p 20 -o strong.jpg

Comparison: Test different intensities.

Verbose Mode

Show detailed processing info:

mediaproc image pixelate image.png -p 8 --verbose

Output: Original size, processing steps, output details.

Portrait Pixelation

Pixelate portrait for effect:

mediaproc image pixelate portrait.jpg --pixels 6

Artistic: Pixel art portrait style.

Landscape Retro

Retro gaming landscape:

mediaproc image pixelate landscape.jpg -p 10 -o retro-landscape.jpg

Gaming: Retro game background style.

Logo Pixelation

Pixelate logo for creative effect:

mediaproc image pixelate logo.png -p 4

Branding: Pixelated logo variation.

Preview Operation

Check before applying:

mediaproc image pixelate photo.jpg --pixels 15 --dry-run

Safety: Verify settings before processing.

Extreme Blocks

Very large pixel blocks:

mediaproc image pixelate image.png --pixels 50

Extreme: Maximum blockiness for dramatic effect.

Use Cases

Retro Gaming Graphics

Create 8-bit or 16-bit style:

# 8-bit style
mediaproc image pixelate sprite.png --pixels 8

# 16-bit style
mediaproc image pixelate character.png --pixels 12

Gaming: Perfect for retro game assets, pixel art.

Privacy Protection

Obscure faces, text, or sensitive info:

# Blur faces
mediaproc image pixelate group-photo.jpg --pixels 20

# Hide text
mediaproc image pixelate document.png -p 25

Privacy: GDPR compliance, content moderation.

Artistic Effects

Creative pixelated style:

# Subtle art effect
mediaproc image pixelate portrait.jpg -p 6

# Strong artistic style
mediaproc image pixelate photo.jpg -p 15

Art: Unique visual aesthetic, modern pixel art.

Censorship/Redaction

Hide sensitive content:

# Moderate censorship
mediaproc image pixelate sensitive.jpg --pixels 20

# Heavy censorship
mediaproc image pixelate classified.png -p 40

Compliance: Redact PII, sensitive data, classified info.

Vintage/Retro Look

Early computer graphics style:

# Vintage computer style
mediaproc image pixelate photo.jpg -p 10

# Early digital camera look
mediaproc image pixelate image.png -p 8

Nostalgia: Retro digital aesthetic.

Social Media Content

Eye-catching pixelated posts:

# Instagram pixelated aesthetic
mediaproc image pixelate post.jpg -p 12

# TikTok retro effect
mediaproc image pixelate video-frame.png -p 8

Social: Trendy pixelated content.

Game Development

Create pixel art assets:

# Game sprites
mediaproc image pixelate character.png --pixels 8

# Background tiles
mediaproc image pixelate tile.jpg -p 10

GameDev: Quick pixel art conversion.

Low-Resolution Aesthetic

Intentional low-res look:

# Low-res monitor style
mediaproc image pixelate photo.jpg -p 15

# Early LCD screen look
mediaproc image pixelate image.png -p 12

Aesthetic: Deliberate low-resolution style.

Combining with Other Commands

Pixelate + Sepia

Vintage pixelated photo:

# Pixelate first
mediaproc image pixelate photo.jpg -p 10 -o temp.jpg

# Add sepia tone
mediaproc image sepia temp.jpg -o vintage-pixel.jpg

Vintage: Retro pixelated sepia photograph.

Resize + Pixelate

Optimize then pixelate:

# Resize to smaller
mediaproc image resize large.jpg -w 800 -o resized.jpg

# Apply pixelation
mediaproc image pixelate resized.jpg -p 10

Efficiency: Faster processing on smaller images.

Pixelate + Border

Framed pixelated image:

# Pixelate
mediaproc image pixelate photo.jpg -p 8 -o pixel.jpg

# Add border
mediaproc image border pixel.jpg --width 10 --color black

Framing: Bordered pixel art style.

Crop + Pixelate

Pixelate specific area:

# Crop area of interest
mediaproc image crop photo.jpg --x 100 --y 100 --width 200 --height 200 -o face.jpg

# Pixelate cropped area
mediaproc image pixelate face.jpg --pixels 30

Privacy: Blur specific regions (faces, license plates).

Technical Details

Algorithm

Nearest Neighbor Resampling:

  • Downscale to (width ÷ pixels) × (height ÷ pixels)
  • Upscale to original size using nearest neighbor
  • No interpolation = blocky appearance

Calculation

For 1920×1080 image with 10px blocks:

  • Shrink to: 192×108 pixels (1920÷10, 1080÷10)
  • Enlarge to: 1920×1080 pixels (nearest neighbor)
  • Result: 10×10 pixel blocks

Performance

  • Very Fast: Resize operations are efficient
  • Small images (less than 1MP): ~50-100ms
  • Medium images (5MP): ~100-200ms
  • Large images (greater than 10MP): ~200-400ms
  • Larger pixel sizes: Faster (less shrunk image data)

File Size

Pixelated images often:

  • Compress better (fewer unique colors)
  • Smaller file sizes (JPEG/WebP benefit from blocks)
  • PNG can be larger (depends on compression)

Best Practices

Start with Default

Begin with size 10, adjust as needed:

# Test default first
mediaproc image pixelate photo.jpg

# Adjust if needed
mediaproc image pixelate photo.jpg -p 15

Match Pixel Size to Purpose

Privacy: 15-30 pixels

mediaproc image pixelate sensitive.jpg -p 20

Artistic: 5-12 pixels

mediaproc image pixelate art.jpg -p 8

Extreme: 30-50 pixels

mediaproc image pixelate censor.jpg -p 40

Use Dry Run

Test settings first:

mediaproc image pixelate photo.jpg --pixels 15 --dry-run

Consider Output Format

JPEG: Good compression for pixelated images

mediaproc image pixelate photo.png -p 10 -o output.jpg

PNG: If you need transparency

mediaproc image pixelate logo.png -p 8 -o pixel-logo.png

Batch Similar Content

Process multiple images:

# All with same pixel size
mediaproc image pixelate "photos/*.jpg" --pixels 10

Combine Effects for Style

Pixelate + other effects:

# Retro sepia pixelated
mediaproc image pixelate photo.jpg -p 8 -o temp.jpg
mediaproc image sepia temp.jpg -o retro.jpg

Power of Two Sizes

Use 2, 4, 8, 16 for cleaner results:

# 8-bit style
mediaproc image pixelate image.jpg -p 8

# 16-bit style
mediaproc image pixelate image.jpg -p 16

Troubleshooting

Issue: Too Pixelated

Problem: Image is too blocky, unrecognizable

Cause: Pixel size too large

Solution: Use smaller pixel size

# Too much
mediaproc image pixelate photo.jpg -p 40

# Better
mediaproc image pixelate photo.jpg -p 10

Issue: Not Enough Effect

Problem: Pixelation barely visible

Cause: Pixel size too small

Solution: Increase pixel size

# Too subtle
mediaproc image pixelate photo.jpg -p 2

# More visible
mediaproc image pixelate photo.jpg -p 10

Issue: File Size Increased

Problem: Output larger than input

Cause: PNG format with compression

Solution: Use JPEG for pixelated images

# May be larger (PNG)
mediaproc image pixelate photo.png -p 10

# Likely smaller (JPEG)
mediaproc image pixelate photo.png -p 10 -o photo-pixel.jpg

Issue: Artifacts at Edges

Problem: Edge artifacts visible

Cause: Image dimensions not divisible by pixel size

Solution: This is normal behavior. Adjust pixel size if needed.

Issue: Processing Slow

Problem: Takes long time

Cause: Very large image

Solution: Resize first

# Resize, then pixelate (faster)
mediaproc image resize huge.jpg -w 2000 -o temp.jpg
mediaproc image pixelate temp.jpg -p 10
  • blur - Alternative for privacy/obscuring
  • sepia - Combine for vintage pixelated look
  • resize - Resize before pixelating for speed
  • border - Frame pixelated images

Further Reading

Found an issue? Help us improve this page.

Edit on GitHub →