Skip to main content

A Python CLI tool for sorting pixels in images.

Project description

pixelsort cli

tests package CodeQL

A simple python command line tool for sort pixels in an image. Based on the works of Kim Asendorf.

The script blocks pixels into dark and light areas using a contrast mask. Then it sorts the pixels in a given direction via their luminance.

  • You can increase/decrease the contrast by setting the threshold.
  • You can also invert the mask to sort the light pixels instead of the dark ones.

Usage

Install

pip install git+https://github.com/Blotz/pixelsort-cli

or

pip install pixelsort-cli

Examples

pixelsort --help
usage: pixelsort [-h] [--threshold THRESHOLD] [--sort_brightest SORT_BRIGHTEST] [--reverse_sorting REVERSE_SORTING] [--output OUTPUT]
                 image_path angle

Command line tool for sorting pixels in images

positional arguments:
  image_path            path to image
  angle                 angle that the image is sorted. 0° is up. [0, 360]

options:
  -h, --help            show this help message and exit
  --threshold THRESHOLD
                        threshold for contrast. [-1.0, 1.0] Default: 1.0
  --sort_brightest SORT_BRIGHTEST
                        Sort the brightest area of the image. Default: True
  --reverse_sorting REVERSE_SORTING
                        Sorts the pixels from lightest to darkest instead of darkest to lightest. Default: False
  --output OUTPUT       path to output file
pixelsort data/mountains.jpg 90 --threshold 1.2

example 1


License

MIT Ferdinand Theil

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pixelsort-cli-0.1.7.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

pixelsort_cli-0.1.7-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page