Have a look at this post or /r/pixelsorting
All credit goes to this repo for all the basic parts of this program! This program wouldn't be anything without it.
The program will install these for you. All you need is python 3.7+ and Git and the script will work. However, you can install these manually if you desire.
Requires Pillow. pip install Pillow
should work. If not, see here for details.
Requires requests. pip install requests
Requires tqdm. pip install tqdm
Requires numpy. pip install numpy
There is also a requirements file which pretty much does the same via pip install -r requirements.txt
.
To install all at once, run pip install pillow requests tqdm numpy
or let the program install them for you.
From the command line:
git clone https://github.com/wolfembers/Pixelsorting.git
cd Pixelsorting
python3 pixelsort.py
There are presets included. However, if you wish to use any of the "past runs" with your own image, you can use a preset ID
. The preset ID is created from the date/time when the image was created.
For instance, an image created on 06/18/2019 at 11:38
has the ID of 061820191138
Most of the images created before 06/10/2019 do NOT have preset ID's.
Starting image MUST be provided in a direct URL. Interval functions, sorting functions, and arguments are parsed after the program runs. No arguments are parsed when the script is called from the command line.
The output image is provided as a direct image link hosted on put.re or saved locally if the user does not have internet.
Tip: To replicate Kim Asendorf's original processing script, first sort vertically and then horizontally in threshold
(default) mode
Parameter | Flag | Description |
---|---|---|
Randomness | -r |
What percentage of intervals not to sort. 0 by default. |
Threshold (lower) | -t |
How dark must a pixel be to be considered as a 'border' for sorting? Takes values from 0-1. 0.25 by default. Used in edges and threshold modes. |
Threshold (upper) | -u |
How bright must a pixel be to be considered as a 'border' for sorting? Takes values from 0-1. 0.8 by default. Used in threshold mode. |
Char. length | -c |
Characteristic length for the random width generator. Used in mode random . |
Angle | -a |
Angle at which you're pixel sorting in degrees. 0 (horizontal) by default. |
Interval function | Description |
---|---|
random |
Randomly generate intervals. Distribution of widths is linear by default. Interval widths can be scaled using clength . |
edges |
Performs an edge detection, which is used to define intervals. Tweak threshold with threshold . |
threshold |
Intervals defined by lightness thresholds; only pixels with a lightness between the upper and lower thresholds are sorted. |
waves |
Intervals are waves of nearly uniform widths. Control width of waves with clength . |
snap |
Intervals are sorted by random first, then half the pixels are changed to be transparent. |
shuffle-total |
Intervals are shuffled. |
shuffle-axis |
Intervals are shuffled across the Y axis. |
file |
Intervals taken from another specified input image. Must be black and white. |
file-edges |
Intevals defined by performing edge detection on the file specified by the ElementaryCA function. Must be the same size as the input image. |
none |
Sort whole rows, only stopping at image borders. |
Sorting function | Description |
---|---|
lightness |
Sort by the lightness of a pixel according to a HSV representation. |
hue |
Sort by the hue of a pixel according to a HSV representation. |
saturation |
Sort by the saturation of a pixel according to a HSV representation. |
intensity |
Sort by the intensity of a pixel, i.e. the sum of all the RGB values. |
minimum |
Sort on the minimum RGB value of a pixel (either the R, G or B). |
All examples were made using the full random
preset.
- Allow defining different intervals for different channels.