4.0.5 • Published 3 years ago

@rusticflare/pixel-sorter v4.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

pixel-sorter

ko-fi

npm License GitHub Sponsors

A command line app for pixel sorting images

If you need help, find bugs, or want a new feature: please raise an issue

Inspired by satyarth/pixelsort

Installation

Prerequisites

npm

  • Install npm.
  • You are downloading the command line client that lets you install pixel-sorter from the npm repository

Install (and Update) pixel-sorter

npm i -g @rusticflare/pixel-sorter

Usage

Pixel Sort Your First Image

This will pixel sort an image called example.jpg in your current directory and save the output in the same directory as example.jpg.

pixel-sorter example.jpg

Note: A one pixel border is cropped from the output file (this is due to this pixel sorter making some of those outer pixels slightly transparent)

  • Powershell
    • Make sure you are running as an Administrator
    • If you see this error:
      ... cannot be loaded because the execution of scripts is disabled on this system.
      run:
      Set-ExecutionPolicy RemoteSigned
      (See this StackOverflow answer for more details)

Options

See Examples for how to use these

OptionArgumentDescriptionDefault Value
-pA patternThe patterns to sort alonglines
-oTextThe name of the output file (e.g. sorted)The current date and time
-mFileThe path to "mask" fileN/A
-fFileThe path to a file to be used by the randomfile interval functionN/A
-aA number in 0.0-360.0The angle to sort along (as degrees on a compass)0.0
-iAn interval functionThe interval function to uselightness
-lA number in 0.0-1.0The darkest lightness to include in sorted sections (used when the interval function is lightness)0.25
-uA number in 0.0-1.0The brightest lightness to include in sorted sections (used when the interval function is lightness)0.8
-wA positive whole numberThe average width (in pixels) of the random[file] sorted sections (used when the interval function is random[file])400
-sA sorting functionThe sorting function to uselightness
-eA filetypeThe extension of the filetype to outputjpg
-cA pair of integersThe center of the circle when the circles pattern is used0 0
-rN/AReverse the sorting orderN/A
-hN/APrint the help messageN/A

Patterns

  • lines
  • circles

Interval Functions

  • lightness - pixels with a lightness between the -l and -u values are sorted
  • random - random sections of average width -w are sorted
  • randomfile - the brighter a pixel in a file provided by -f makes a pixel more likely to be sorted (use -w to control the average width)
  • none - everything is sorted

Sorting Functions

  • hue
  • saturation
  • lightness
  • intensity

Filetypes

  • jpg
  • png

Examples

example.jpg:

npm.io

Default

pixel-sorter example.jpg

npm.io

Threshold

When using the lightness interval function: only pixels with a lightness between -l and -u will be sorted.

Here we sort pixels with a lightness between 0.6 and 0.9:

pixel-sorter example.jpg -l 0.6 -u 0.9

npm.io

Angle 🧭

You can change the sorting angle (as degrees on a compass).

pixel-sorter example.jpg -a 315

npm.io

Circles 🟣

Sort circles with:

  • center -200 -600 (0 0 is the center of the image)
  • angle 210 (where the brightest and darkest pixels meet)
  • reversed sort
pixel-sorter example.jpg -p circles -c -200 -600 -a 210 -r

npm.io

Mask & Random 🎭

A "mask" file should be a black and white image (the same size as the sorted image). Only the white sections are considered for sorting.

-i random causes random sections of the image should be sorted. You can control the average width (in pixels) of these sections with -w.

example-mask.jpg:

npm.io

pixel-sorter example.jpg -m example-mask.jpg -a 135 -i random

npm.io

Random File

The brighter the pixel in -f the more likely the corresponding pixel is to be sorted.

example-randomfile-mask.jpg:

npm.io

pixel-sorter example.jpg -i randomfile -f example-randomfile-mask.jpg

npm.io

ko-fi

4.0.5

3 years ago

4.0.4

3 years ago

4.0.1

3 years ago

4.0.3

3 years ago

4.0.2

3 years ago

4.0.0

3 years ago

3.0.6

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.0

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago