@pixelsorter is a Twitter bot written in Ruby heavily utilizing EVA-01/pxlsrt and mispy/twitter_ebooks. It sorts the rows (or optionally columns) of an image according to a specific method like hue, red, brightness, luma, etc. Simply attach an image to your tweet (links to images currently not supported) and mention @pixelsorter. @pixelsorter will respond with an image that has been processed using one of a number of random presets.
There are a number of presets available. You can specify a preset by including the string
preset with the name of the preset between the brackets. For example, to use the "drip" preset, you would include
preset[drip]. If @pixelsorter can't find your preset, it will default to a random preset. Below are a list of presets, sample images, and how you would reproduce them using `cmd`, but note that the end effect varies highly depending on the image. I encourage you to experiment!
If you do not specify a
cmd when giving an image to @pixelsorter, a random preset will be chosen along with a slight "shaking" of the parameter values, making sure that random results you get are not identical/boring. If you specify a preset directly, this shaking will not occur.
cmd[middle 2 vertical true]
cmd[middle 5 max 90 min 80 reverse true]
cmd[max 300 min 600 method luma diagonal true reverse true]
no parameters passed
cmd[vertical true max 80 min 10 smooth true method uniqueness]
cmd[middle -3 max 50 min 49 vertical true method saturation]
cmd[vertical true max 300 min 600 method saturation]
cmd[middle -2 max 20 min 10]
cmd[middle 10 max 350 min 350 diagonal true reverse true]
cmd[middle 3 max 300 min 240 diagonal true]
You can pass custom parameters to @pixelsorter by including
cmd in your tweet with a set of parameters between the brackets. Parameters will always come in key-value pairs and should look something like
cmd[max 50 min 20 diagonal true]. You should always have an even number of words between the brackets. If you pass an invalid value as a parameter, @pixelsorter will not respond.
Here are the custom parameter details (mostly a rewriting/copy of the docs in EVA-01/pxlsrt):
method <string>- the method by which to sort pixels.
sum-rgbby default. Don't actually include the brackets (< and >). There are a number available:
sum-rgb- sorts by the sum of the red, green, and blue values of the pixels
red- sorts by the red value of the pixels
green- sorts by the green value of the pixels
blue- sorts by the blue value of the pixels
sum-hsb- sorts by the sum of the hue, saturation, and brightness values of pixels. smoothing option is suggested for this method.
smooth trueis suggested
hue- sorts by the hue value of the pixels, looks like a rainbow.
smooth trueis suggested
saturation- sorts by the saturation value of the piexls, looks like bands fade to grey.
smooth trueis suggested
brightness- sorts by the brightness value of the pixels
uniqueness- sorts by the "distance" of the pixel from the average color of the band
luma- sorts by human color perception
random- randomizes the pixels
magenta- sorts by a magenta value
cyan- sorts by a cyan value
yellow- sorts by a yellow value
alpha- sorts by the opacity of a pixel
sum-rgba- sorts by the sum of the red, green, blue, and alpha values
sum-hsba- sorts by the sum of the hue, saturation, brightness, and alpha values
min <integer>- minimum length of bandwidth to sort, 1 to infinity--by default is infinity. Don't pass infinity manually, as @pixelsorter doesn't accept a string for this param
min <integer>- maximum length of bandwidth to sort, 1 to infinity--by default is infinity. Don't pass infinity manually, as @pixelsorter doesn't accept a string for this param
vertical <boolean>- will sort vertically instead of horizontally.
smooth <boolean>- places identical pixels adjacent to each other in the band.
reverse <boolean>- sorts in reverse.
diagonal <boolean>- sorts diagonally.
middle <integer>- "middlates"--essentially creates a mirror effect by sorting from the middle out. If you pass
1, you'll have a mirror effect. If you pass more, you'll get a duplicated mirror effect. Negative numbers will cause interesting ripple effects. By default,
middleis disabled. Numbers greater than 20 or less than -20 are capped because of the memory-intensiveness of this operation.
You can have @pixelsorter return the full, high-resolution version of your image. Ordinarily @pixelsorter will download the default medium size of your image that is displayed on twitter, but if you include the string
hires in your tweet, @pixelsorter will download and return the largest available image.
hires should be included outside of
preset. For example, these two tweets would return high resolution images:
@pixelsorter cmd[vertical true] hires
@pixelsorter preset[drip] hires