Package: pixelsort
pixelsortWhat is Pixel Sorting?Have a look atthis postor/r/pixelsortingDependenciesShould work in both Python 2 and 3, but Python 3 is recommended.UsageFrom the command line:pip install pixelsort
python3 -m pixelsort %PathToImage% [options]Tip: To replicate Kim Asendorf's originalprocessing script, first sort vertically and then horizontally inthreshold(default) mode:python3 -m pixelsort %PathToImage% -a 90
python3 -m pixelsort %PathToSortedImage%As a package:>>> from pixelsort import pixelsort
>>> from PIL import Image
>>> a = Image.open("examples/image.jpg")
>>> a
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=576x324 at 0x7F8F6A2AC208>
>>> pixelsort(a)
<PIL.Image.Image image mode=RGBA size=576x324 at 0x7F8F66AA57B8>Parameters:ParameterFlagDescriptionInterval function-iControls how the intervals used for sorting are defined. See below for more details and examples. Threshold by default.Output path-oPath of output file. Uses the current time for the file name by default.Randomness-rWhat percentage of intervalsnotto sort. 0 by default.Threshold (lower)-tHow dark must a pixel be to be considered as a 'border' for sorting? Takes values from 0-1. 0.25 by default. Used inedgesandthresholdmodes.Threshold (upper)-uHow bright must a pixel be to be considered as a 'border' for sorting? Takes values from 0-1. 0.8 by default. Used inthresholdmode.Char. length-cCharacteristic length for the random width generator. Used in moderandomandwaves.Angle-aAngle at which you're pixel sorting in degrees.0(horizontal) by default.External interval file-fImage used to define intervals. Must be black and white.Sorting function-sSorting function to use for sorting the pixels. Lightness by default.Mask-mImage used for masking parts of the image.Logging level-lLevel of logging statements made visible. Choices includeDEBUG,INFO,WARNING,ERROR, andCRITICAL.WARNINGby default.Interval FunctionsInterval functionDescriptionrandomRandomly generate intervals. Distribution of widths is linear by default. Interval widths can be scaled usingclength.edgesPerforms an edge detection, which is used to define intervals. Tweak threshold withthreshold.thresholdIntervals defined by lightness thresholds; only pixels with a lightness between the upper and lower thresholds are sorted.wavesIntervals are waves of nearly uniform widths. Control width of waves withclength.fileIntervals taken from another specified input image. Must be black and white, and the same size as the input image.file-edgesIntevals defined by performing edge detection on the file specified by-f. Must be the same size as the input image.noneSort whole rows, only stopping at image borders.Sorting FunctionsSorting functionDescriptionlightnessSort by the lightness of a pixel according to a HSV representation.hueSort by the hue of a pixel according to a HSV representation.saturationSort by the saturation of a pixel according to a HSV representation.intensitySort by the intensity of a pixel, i.e. the sum of all the RGB values.minimumSort on the minimum RGB value of a pixel (either the R, G or B).Examplespython3 -m pixelsort examples/image.jpg -i random -c 20python3 -m pixelsort examples/image.jpg -i edges -t .5file: Intervals taken from image specified with-f. Must be black and white.python3 -m pixelsort examples/image.jpg -i file -f examples/intervals.png(generated withelementary-ca)mask: Mask taken from image specified with-m. Must be black and white.python3 -m pixelsort examples/image.jpg -i random -c 20 -m examples/mask.pngTodoAllow defining different intervals for different channels.Based onhttps://gist.github.com/prophetgoddess/667c5554e5d9d9a25ae6