# Pixel sorting according to different methods

**URL:** <https://community.wolfram.com/t/pixel-sorting-according-to-different-methods/6442>\
**Category:** Staff Picks\
**Tags:** image-processing, computational-arts, graphics-and-visualization, interface-construction, staff-pick\
**Created:** [August 15, 2015, 1:35pm UTC](https://community.wolfram.com/t/pixel-sorting-according-to-different-methods/6442 "2015-08-15T13:35:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erikmahieu](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/erikmahieu/32/8091_2.png) [@erikmahieu](https://community.wolfram.com/u/erikmahieu)\
**Post date:** [August 15, 2015, 1:35pm UTC](https://community.wolfram.com/t/pixel-sorting-according-to-different-methods/6442/1 "2015-08-15T13:35:31Z")

</div>

Inspired by a [tweet](https://twitter.com/WolframResearch) from Wolfram Research and their link to [this](http://www.glitchet.com/pixelsorter), I made this Manipulate.  
Hopefully it will inspire others to do better?

```
Manipulate[
 Image[RotateLeft[#, t] & /@ 
   RotateLeft[SortBy[ImageData[im], fun[#[[All, c]]] &], s]],
 {{fun, First, "function applied"}, {First, Last, Mean, Median, Norm, 
   Normalize, StandardDeviation, Total, Accumulate, 
   Flatten@Gather[#] &, Sort, Commonest, Differences, 
   TrimmedMean[#, .35] & -> "trimmedMean", 
   TakeLargest[#, 1] & -> "takelargest", Nearest[#, {0, 0, .5}] &}, 
  PopupMenu},
 {{c, 1, "color"}, {1 -> "red", 2 -> "green", 3 -> "blue"}, SetterBar},
 {{s, 0, "shift up-down"}, -200, 200, 1},
 {{t, 0, "shift right-left"}, -200, 200, 1}]

```

The original pic is [here](http://www.publicdomainpictures.net/view-image.php?image=30653&picture=the-colored-balls)  
One result of pixel sort is here

 ![PixelSorter-1.jpg](https://global.discourse-cdn.com/wolfram/original/3X/1/0/1019c8716c28880596f063cfe27d3b8a441853cf.jpeg)

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [March 24, 2021, 8:28pm UTC](https://community.wolfram.com/t/pixel-sorting-according-to-different-methods/6442/2 "2021-03-24T20:28:52Z")

</div>

![news-congrads-kkluyshnik-02-04-19.jpg](https://global.discourse-cdn.com/wolfram/original/3X/6/a/6a310c2d0904616faf4e6e148260c9f29ab9f4eb.jpeg) – you have earned _ **Featured Contributor Badge** _ ![2015-11-02_10-07-11.png](https://global.discourse-cdn.com/wolfram/original/3X/5/0/50e59c9ead62f729e7130d3ea1482555a75602b6.png)  
Your exceptional post has been selected for our editorial column _ **Staff Picks** _ [http://wolfr.am/StaffPicks](http://wolfr.am/StaffPicks) and [Your Profile](http://community.wolfram.com/web/erikmahieu) is now distinguished by a _ **Featured Contributor Badge** _ and is displayed on the [Featured Contributor Board](https://community.wolfram.com/people). Thank you!
