Image Processing

Pixel Sorting: The Glitch Art Technique Taking Over Digital Design

By Harto Atelier·April 1, 2026·7 min read

Pixel sorting is a glitch art technique that creates striking visual effects by rearranging pixels in an image based on their properties. What started as a creative coding experiment has become one of the most recognizable aesthetics in modern digital art.

What is Pixel Sorting?

At its core, pixel sorting is simple: take rows or columns of pixels and sort them by a property like brightness, hue, or saturation. But this simple operation creates complex, beautiful, and often unpredictable results. The technique breaks up photographic reality while maintaining recognizable elements, creating a perfect balance between order and chaos.

The effect was popularized by artist Kim Asendorf in 2010 with his Processing sketch that sorted pixels based on brightness thresholds. Since then, it's been adopted by album cover designers, fashion photographers, and digital artists worldwide.

How Does Pixel Sorting Work?

The basic algorithm follows these steps:

  • Choose a direction: Horizontal, vertical, or even diagonal sorting produces dramatically different results.
  • Select a sorting property: Brightness is most common, but hue, saturation, or even alpha values can be used.
  • Define intervals: Instead of sorting entire rows, intervals are defined based on edge detection or threshold values. This preserves some structure.
  • Sort the intervals: Pixels within each interval are reordered based on the chosen property.
  • Optional masking: Advanced implementations allow masking to protect certain areas from sorting.

Sorting Methods Explained

Brightness Sorting

The classic approach. Pixels are sorted from darkest to brightest within each interval. This creates smooth gradients that bleed from dark to light areas, often producing a "melting" or "dripping" effect.

  • Best for: Portraits, landscapes, high-contrast images
  • Effect: Dramatic vertical or horizontal streaks
  • Tip: Works exceptionally well on backlit subjects

Hue Sorting

Pixels are sorted by their position on the color wheel. This creates rainbow-like gradients and can produce psychedelic effects, especially on colorful images.

  • Best for: Colorful abstract images, street photography, neon scenes
  • Effect: Color bleeding, rainbow gradients
  • Tip: Try circular hue sorting for unique spiral effects

Saturation Sorting

Sorting by color intensity. Gray/desaturated pixels cluster together, while vibrant colors group separately. This can create interesting separations between muted and vivid areas.

  • Best for: Images with mixed saturated/desaturated elements
  • Effect: Color intensity gradients
  • Tip: Combine with brightness for complex results

Advanced Techniques

Edge Detection Intervals

Instead of fixed intervals, use edge detection (Sobel, Canny) to define sorting boundaries. This preserves important edges and creates more structured, less chaotic results. Perfect for maintaining facial features or architectural elements.

Threshold-Based Sorting

Only sort pixels that meet certain criteria (e.g., brightness > 50%). This creates selective sorting effects where only highlights or shadows are affected, leaving other areas untouched.

Dual-Direction Sorting

Apply horizontal sorting, then vertical (or vice versa). This creates grid-like patterns and even more abstract results. The order matters—experiment with both sequences.

Masked Sorting

Use a mask to protect certain areas from sorting. For example, keep a subject's face intact while sorting the background, or sort only specific regions for targeted effects.

Creative Applications

Album Covers

Pixel sorting has become iconic in music branding. Artists like Aphex Twin, Flying Lotus, and countless electronic musicians use the aesthetic for its balance of digital disruption and visual appeal.

Portrait Photography

Fashion and editorial photographers use subtle pixel sorting to add an avant-garde edge. Sorting only shadows or highlights can create ethereal, dreamlike portraits.

Motion Graphics

Animated pixel sorting creates mesmerizing transitions. Videos with pixel-sorted frames produce hypnotic effects, especially when sorting parameters change over time.

Generative Art

Combine pixel sorting with other generative techniques. Feed sorted images back into the algorithm, blend multiple sorting directions, or use sorting as one step in a larger creative pipeline.

Tips for Better Results

  • Start with high-contrast images: Images with clear darks and lights produce the most dramatic effects.
  • Try different angles: Rotate your image before sorting, then rotate back for diagonal streaks.
  • Layer multiple sorts: Export a sorted version, reimport it, and sort again with different parameters.
  • Adjust interval thresholds: Smaller intervals preserve more structure; larger intervals create more chaos.
  • Combine with other effects: Pixel sorting works beautifully with glitch effects, datamoshing, or color grading.
  • Keep backups: The effect is destructive—always work on copies.

The Aesthetic's Cultural Impact

Pixel sorting represents a broader shift in digital aesthetics. Rather than hiding digital artifacts, we embrace them. The technique celebrates computational processes, making the algorithm visible. It's digital art that couldn't exist without computers—there's no analog equivalent.

This aligns with the broader "glitch art" movement, which finds beauty in errors, compression artifacts, and digital degradation. Pixel sorting is controlled glitching—intentional chaos that produces consistently striking results.

Technical Implementation

For developers interested in implementing pixel sorting, the basic algorithm in pseudocode:

for each row in image:
  intervals = detectIntervals(row, threshold)
  for each interval in intervals:
    pixels = getPixels(interval)
    sorted = sortBy(pixels, property) // brightness, hue, etc.
    replacePixels(interval, sorted)

Edge detection intervals provide more sophisticated results:

edges = detectEdges(image, method='sobel')
for each row in image:
  intervals = splitByEdges(row, edges)
  for each interval:
    sortPixels(interval, sortBy='brightness')

Try Pixel Sorting Online

Ready to create your own pixel-sorted masterpieces? Our free Pixel Sort Tool lets you experiment with different sorting methods, directions, and interval detection techniques. Upload any image, adjust parameters in real-time, and download your glitch art—all processed locally in your browser with zero upload required.

Start with a portrait or landscape photo, apply horizontal brightness sorting with edge detection, and watch your image transform into striking digital art. The results might surprise you.