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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file pixelsort-cli-0.1.7.tar.gz.

File metadata

  • Download URL: pixelsort-cli-0.1.7.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for pixelsort-cli-0.1.7.tar.gz
Algorithm Hash digest
SHA256 6a40add0fbc8deb310cbed4b7a1c69e9470cbdaf7aa9d5c9664a1b1992197e8c
MD5 0430bbb9a4e4ac5335da0b9fbf794725
BLAKE2b-256 cd82f5ec862e6019e36ef46aeeac2af0efe6371b9f34ae59b9120faf815d5370

See more details on using hashes here.

File details

Details for the file pixelsort_cli-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for pixelsort_cli-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 079e4c0fefa94d81f5529b93482204af84561e6be97637ac5172c377fb6e74c2
MD5 cea97b7585e8cbd2d1d0d990e7756601
BLAKE2b-256 934595d369a40e2318b0c2857285d393b79454a1d9c785403b7851316f3497dc

See more details on using hashes here.

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