Skip to main content

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

or

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

Examples

pixelsort --help
usage: pixelsort [-h] [--angle ANGLE] [--image_path IMAGE_PATH] [--threshold THRESHOLD | --template_path TEMPLATE_PATH]
                 [--sort_brightest SORT_BRIGHTEST] [--reverse_sorting REVERSE_SORTING] [--output OUTPUT] [--verbose | --quiet]
                 [stdin]

Command line tool for sorting pixels in images

positional arguments:
  stdin

options:
  -h, --help            show this help message and exit
  --angle ANGLE         angle that the image is sorted. 0° is up. [0, 360]
  --image_path IMAGE_PATH
                        path to image
  --threshold THRESHOLD
                        threshold for contrast. [-1.0, 1.0] Default: 1.0
  --template_path TEMPLATE_PATH
                        path to template image
  --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
  --verbose             print debug messages
  --quiet               print less messages
pixelsort --image_path data/mountains.jpg --threshold 1.2 | display

example 1

cat data/mountains.jpg | pixelsort --template_path data/pyramid_mask.png | display

example 2

pixelsort --image_path data/mountains.jpg --angle 30 --threshold 1.2 --output example.png

example 3

Use it with other tools like imagemagick

magick data/mountains.jpg -colorspace gray PNG:- | pixelsort | display

example 4


License

MIT Ferdinand Theil

Metadata

Release files for pixelsort-cli 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pixelsort-cli 1.1.0
File Size Uploaded
pixelsort_cli-1.1.0.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pixelsort-cli 1.1.0
File Interpreter ABI Platform
pixelsort_cli-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.8 kB

Release files / pixelsort_cli-1.1.0.tar.gz

Download URL pixelsort_cli-1.1.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
95eda58c92d10a223c34dffa40bdfdd490559c5d1a85ee47b795133e2724ab6d
BLAKE2b-256 checksum
How to use checksums
b15dfa029d9e79cd1710c840f06693c044f33cce33c202fd41806333432eca6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Release files / pixelsort_cli-1.1.0-py3-none-any.whl

Download URL pixelsort_cli-1.1.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a84197dd08ad37ee39aee9ed80d0e62c81f01451c02e500f3d6cf6ca78e177e0
BLAKE2b-256 checksum
How to use checksums
c6e49933426bf1e68d244be3b516232a30bc5100ab91cc006b98036c2afa527a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.22

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page