A pixel sorting library. Sorts pixels in an image based on input parameters and saves intermediate steps in the sort process as separate images that can then be used to create a video or gif.
Note: this library is still under development and not all planned features are available.
- Only works on PNG images (for now)
- Only saves final sorted image, no intermediate images (for now)
- Only sorts in a straight line (for now)
- Only sorts using
std::sort()
(for now)
- Only sorts entire image, cannot sort segments (for now)
- Sort value not yet exposed
Original |
Sorted |
Sorted |
|
pixel-glitch images/profile.png |
pixel-glitch images/profile.png --reverse |
![](https://raw.githubusercontent.com/rtedwards/pixel-glitch/main/./docs/profile.png) |
![](https://raw.githubusercontent.com/rtedwards/pixel-glitch/main/./docs/profile_sorted.png) |
![](https://raw.githubusercontent.com/rtedwards/pixel-glitch/main/./docs/profile_sorted_reversed.png) |
|
pixel-glitch images/monterey.png |
pixel-glitch images/monterey.png --reverse |
![](https://raw.githubusercontent.com/rtedwards/pixel-glitch/main/./docs/monterey.png) |
![](https://raw.githubusercontent.com/rtedwards/pixel-glitch/main/./docs/monterey_sorted.png) |
![](https://raw.githubusercontent.com/rtedwards/pixel-glitch/main/./docs/monterey_sorted_reversed.png) |
|
pixel-glitch images/sunset.png |
pixel-glitch images/sunset.png --reverse |
![](https://raw.githubusercontent.com/rtedwards/pixel-glitch/main/./docs/sunset.png) |
![](https://raw.githubusercontent.com/rtedwards/pixel-glitch/main/./docs/sunset_sorted.png) |
![](https://raw.githubusercontent.com/rtedwards/pixel-glitch/main/./docs/sunset_sorted_reversed.png) |
pixel-glitch images/profile.png
Available features are emboldened in the table below.
CLI Arg |
Examples |
Description |
![]() |
![]() |
![]() |
--algorithm |
Sorting algorithm to use. |
[bubblesort , heapsort , insertionsort , introsort , mergesort , quicksort ] |
--angle |
The angle to sort at. Only used for --shape line |
[0 , 90 , 235 ] |
--percent |
The sort percent to stop at. |
[100 , 50 ] |
--reverse |
Reverses the sort direction. |
|
--segment |
Will segment the image and sort each segment separately. |
|
--shape |
The shape to follow when sorting. equation allows for generic functions to be used in the form of y = f(x) |
[line , circle , equation ] |
--value |
The value to use for sorting. If auto will attempt to choose the most "distinct" value. |
[r , rg , rgba , auto ] |