Pixel sorting is a digital art technique that rearranges pixels to create streaks, distortions, and flowing patterns in an image.
In madphase, you can apply it to images, video, or live visuals and control the direction of the streaks and which colours get rearranged.
To get started, open an image and add Glitch → Pixel Sorting. Choose a Path to direct the streaks, an Interval mode to split them into runs, and a Sort By value such as Brightness or Hue to order the pixels in each run.
madphase is the successor to madpixelsort. The original app was built around pixel sorting. In madphase, Pixel Sorting is an editable effect in a layer stack. You can draw a path through the image, make streaks follow its contours, or isolate the sorted pixels and blend them into another layer.
The spiral above starts with a multicolour pigment texture. As Random interval length goes from 0% to 100%, longer streaks wind the colours into the centre. Follow along with the same texture below.
What is pixel sorting?
Pixel sorting rearranges pixels within runs along a path. If you sort a horizontal run from dark to light, the dark pixels collect at one end and the bright ones at the other. Repeat that across the image and patches of colour turn into streaks. A curved path gives those same streaks a different direction.
Artist Kim Asendorf used pixel sorting in his 2010 work Mountain Tour. He later shared ASDFPixelSort, a Processing sketch that let other artists try the technique on their own images. ASDFPixelSort · Asendorf on how he developed the technique
In madphase, Path decides where the streaks travel, Target selects the pixels, Sort By determines how they’re ordered, and Interval divides the path into runs. A brightness threshold can preserve the dark seams in the pigment texture while letting brighter colours streak.
Make your first pixel sort
- Open a project in Still mode and add the 4K pigment texture or an image with distinct colours and clear edges.
- Choose Glitch → Pixel Sorting from the effects picker on the left, or press Cmd/Ctrl + F and search for Pixel Sorting. Add it after the image in processing order and select it to open its panel.
- Start with the default straight path and brightness sort. Set Target to All so the whole image can participate.
- Under Interval, choose Random and set Length to about 28%. Try a shorter length to keep more of the original pigment shapes.
To match the still examples, download the Pigment Study presets and choose Import Preset in the Presets panel.
Compare interval modes
Interval → Mode determines where a sorted run ends. Keep Path → Mode on Linear and Sort By on Brightness for this comparison.
- Threshold ends runs at pixels outside your target range. Set Target to Inclusive, Trigger to Brightness, Max Length to 100% and compare brightness ranges of 2–100% and 40–100%. At a lower cutoff of 2%, more dark pigment joins long runs. At 40%, the darker marks interrupt those runs and more of the texture stays in place.
- Random cuts the path into runs with varied lengths. Set Target to All. At 8%, short runs preserve the outline of the pigment patches. At 28%, longer runs carry colour across those outlines.
- All sorts the entire row as one run at Max Length 100%, with Target still set to All. Look at the left edge, where the darkest pixels collect in each row.
How do you control the direction of pixel sorting?
The direction of a pixel sort determines where pixels move and how the streaks appear. Straight paths create horizontal, vertical, or diagonal streaks. Curved paths produce flowing patterns.
In madphase, use the Path controls to choose Linear, Radial, Spiral, Wave, or a custom-drawn path.
Go back to Random intervals at 28% and change Path → Mode. Linear sends colour in straight lines, Radial sends it out in spokes, and Spiral winds it around a point. Wave and Zig Zag make curved and angular bends. Sweep pulls the image along a broad curve.
Draw a custom sorting path
Choose Spline and turn on canvas handles. Start near the lower left, end near the upper right, and pull the two handles into an S-curve. Increase Width for a broader ribbon and use Start Width or End Width to taper it. Side Feather blends the sides of the ribbon into the original texture.
Sort along image contours and procedural fields
Isophote follows contours of similar brightness. Gradient follows the direction in which brightness changes, so its streaks cross those contours. In both modes, Source Blur controls how much fine texture the paths follow. Increase it if small flecks are breaking up the flow.
Perlin gets its direction from a noise field. Topographic follows contours in a procedural noise field, drawing nested lines like a relief map. Turn on Continuous Streamlines in the advanced Path controls to see these paths without the usual interval breaks.
Compare Traced and Guided Perlin paths
In the advanced Path controls, switch Style between Traced and Guided. Traced breaks into irregular clusters as paths meet. Guided builds more evenly spaced lines through the same field. Pixel Sorting reference
Both renders use Perlin with Feature Size at 16% and path Length at 38%. Set Target and Interval to All, keep Continuous Streamlines off, and set Thickness to 2 px. Only Style changes.
Add a mask to the Pixel Sorting layer to keep a face or logo clear while the surrounding image sorts. Masking reference
Compare brightness, hue, and other ways to sort
Use Linear with Interval → Mode → All, Max Length: 100%, Target: All, and Order: Ascending. Change only Sort By. With the full width of each row available, the difference is easy to see. Brightness moves the dark tones to the left. Hue gathers colours into bands. Saturation brings grey and muted pixels together at one end. Red, Green, and Blue sort by the amount of that channel in each pixel.
When you go back to Threshold intervals, you can set Trigger and Sort By independently. For example, use a Brightness trigger to select highlights and sort them by Hue. Inclusive sorts inside the threshold range. Exclusive sorts outside it, which lets you protect the midtones while sorting the shadows and highlights.
For a separate pass of streaks, use Output Only Sorted in the advanced Sort controls. Combine it with an inclusive brightness threshold to make pixels outside the range transparent. Pixel Sorting reference
Control a pixel sort with other layers
The next madphase update adds layer-source controls, which let one layer influence how pixels are sorted in another. A black-and-white matte can define where streaks start and stop, while a grayscale gradient controls how the original pixels are reordered. You can edit either control layer as you develop the effect. Download the example project.
Start with the pigment texture, a black-and-white circle matte, and a diagonal grayscale ramp on separate layers. Set the Pixel Sorting path to Linear and the interval mode to All.
- In Interval, set Boundary to Matte, choose the circle layer under Source, and set Region to Both. Keep Sort By on Brightness and Max Length at 100%. The streaks stop at the outline and sort independently on each side. Animate the matte layer to move the boundary.
- For the second image, set Region to Inside and Max Length to 4%. In the advanced Effects controls, turn on Feather to soften the ends of the runs. In Sort, choose the diagonal ramp as the Sort source and set Channel to Luminance. The ramp’s brightness reorders the pigment within each short run.
Recolour and soften the streaks
Recolour with a gradient palette
Set Path → Mode to Gradient so the streaks follow changes in source brightness. Set Interval to All, then turn on Gradient in the advanced Effects controls and choose one of madphase’s built-in palettes. The palette runs along each sorted run, and the colours fan out along the curves. You can also edit and animate individual palette stops.
Feather the ends of the streaks
On a Spline, set Interval to All to make one long run along each line of the ribbon. Raise Start Feather and End Feather under Path to fade the whole ribbon into the source at both tips. For a fade on each individual run, use Feather in the advanced Effects controls. Feather Knee sets how far that fade extends into the run. Pixel Sorting reference
For broader streaks, increase Interval → Thickness. To soften jagged edges on curved paths, raise Path AA in the advanced Effects controls.
How do you animate pixel sorting?
Animate pixel sorting by changing how pixels are rearranged over time. You can lengthen the streaks, rotate their direction, or change which parts of the image are affected. Keyframes control these changes to create smooth transitions or abrupt glitch effects.
In madphase, switch to Video mode and use the parameter menu to add keyframes. Start with one control so you can see exactly what changes.
Four ways to animate the sort
- Length makes Random intervals grow and shrink. Longer streaks cross the pigment patches, while shorter streaks reveal their outlines.
- Shift slides the sorted pixels along each run and wraps them around the ends.
- Threshold moves the sort from shadows to highlights and back. Set Target to Inclusive, Trigger to Brightness, and Interval → Mode to Threshold. Give Lower and Upper the same timing and easing to keep the window 20 percentage points wide.
- Angle rotates a Linear sort through a full turn while the run length stays fixed.
Animate a custom path
On the spline example, set Wobble to 28 px and Waves to 2. From the Phase parameter menu, add a keyframe at the start with Phase at 0% and one at three seconds with Phase at 100%. Play the timeline and watch the bends travel through the ribbon.
How do you pixel sort video?
Pixel sorting video rearranges pixels in each frame by properties such as brightness, hue, or saturation. The resulting streaks change with the footage. You can also keyframe the sorting parameters to change the effect throughout the sequence.
In madphase’s Video mode, add Pixel Sorting after the clip to sort each frame along the path you choose.
Temporal Pixel Sort is a separate effect that sorts by brightness where the image changes from one frame to the next. Add it after a moving clip or an animated layer and play forward so it has a previous frame to compare. Raise Threshold if small changes trigger too much of the image, or change Direction to turn the streaks from horizontal to vertical. Temporal Pixel Sort reference
How do you pixel sort in real time?
Real-time pixel sorting rearranges pixels as each frame arrives from a camera or another live source. Use it to create changing distortions for performances, installations, or interactive visuals.
In madphase, switch to Live mode and add Pixel Sorting after your input. Start with Linear at 0° or 180° for horizontal streaks, or 90° or 270° for vertical streaks. Keep Interval → Thickness at 1 px. At these settings, madphase scans rows or columns directly. Other angles trace a path through the image, which can take more time.
In Canvas Output, turn on the FPS overlay to see how each change affects playback. If the composition keeps dropping frames, try these in order.
- Lower preview quality. Use the Render quality selector at the lower right of the canvas while setting up the look.
- Sort a smaller image. Place one Resolution layer before Pixel Sorting and another after it in processing order. Set the first Resolution to Percentage at 50% with Bilinear filtering. A 1920 × 1080 input now sorts at 960 × 540, a quarter of the pixels. Set the second Resolution to Fixed Size at your output dimensions. Upsampling restores the dimensions with less fine detail than a full-resolution sort.
- Build up from one sort. Start with one Pixel Sorting layer and turn off Smoothing and Interval Blur in the advanced Effects controls while tuning. Add them back one at a time and watch the FPS. If the stack still can’t hold your target frame rate, lower the Frame Rate Limit in Canvas Output to a rate the composition can sustain.
For curved Perlin paths, compare Guided and Traced while watching the FPS overlay. Traced and Guided comparison
Preview and Performance · Resolution reference
Build a painted relief with Oil Painter and 3D Augment
Open 3D Pixel Sorted Impasto in Example Projects. The stills below use the same frame from that project, with each stage shown in processing order.
Start with Perlin Noise to create the light and dark texture that the sorter will pull into streaks.
Sort by Brightness along Perlin paths. Enable Continuous Streamlines and use the Nebula gradient palette.
The project places the wordmark and an Invert filter in a group before Oil Painter. The paint pass gathers the fine streaks into broad strokes.
3D Augment uses the brightness of the painted surface to shape the relief. The example uses Depth 0.20 and Contrast 0.55.
The timeline animates Interval → Shift to move the streaks and Light Angle to move the highlights across the painted ridges. Oil Painter controls · 3D Augment controls
How does madphase differ from madpixelsort?
madphase is the successor to madpixelsort and a compositing tool for stills, video, and live visuals on macOS, Windows, and Linux. madpixelsort was built around one effect. It already supported curved paths, masks, video, and keyframes. In madphase, pixel sorting is one layer in a project you can keep editing from the first test through final delivery.
On a music video, you could draw a spline over part of a shot, use the image’s contours to drive a second sort, then mask and blend the two passes separately. Drive the streak length from the soundtrack, finish the look with other effects, and export the animation from the same project. For a live set, use the same effect on a camera feed or drive it with live audio. Animation export · Live performance
madphase has several ways to keep a sort responsive. Its optimized Linear path scans horizontal and vertical runs directly at 1 px thickness. Preview quality lets you try changes at a lower resolution while keeping still exports at full quality. In Video mode, you can cache a pass to review the motion without sorting the same frames again. Real-time pixel sorting · Preview and Performance
Download madphase · Pixel Sorting reference · Recover a madpixelsort download