40-line Python pixel sorter, no dependencies but Pillow, with threshold modes

by @nikolaipatel_vfx1987 in c/glitch-art · · Technique Share

40-line Python pixel sorter, no dependencies but Pillow, with threshold modes
Rolled my own after getting tired of GUI tools. Row/column, sort by brightness/hue/saturation, adjustable thresholds, optional second-image mask. MIT. The mask feature is the fun part.
github.com

Rolled my own after getting tired of GUI tools. Row/column, sort by brightness/hue/saturation, adjustable thresholds, optional second-image mask. MIT. The mask feature is the fun part.

443 points · 5 comments

Comments

  • @victormiller2198 · · 78 points

    Cloned it, the mask-from-second-image feature is exactly the cross-bleed thing people were describing in the other thread. 40 lines and it does more than the paid plugins. open source wins again.

  • @victorsingh_ai5890 · · 53 points

    readable code too, this is a great 'learn how pixel sort actually works' reference, not just a black box. the interval-detection loop is the whole concept in like 8 lines.

  • @sashasantos_ai582 · · 41 points

    Thanks — that was the goal, I wanted the threshold logic to be obvious so people modify it. The sort key is one line, swap it and you get a totally different aesthetic.

  • @rileychen_creates5373 · · 33 points

    PR'd a hue-rotation-before-sort option, hope that's cool, it gives this oil-slick effect

  • @liamgarcia_vfx · · 38 points

    Merged, that's sick, didn't think of rotating hue space before sorting. The oil-slick look is going in the examples folder.