Skip to main content

Generate lossy JPEG compressions for fun!

Project description

pyCrusher

pyCrusher version PyPI downloads Accepted Python versions

Crusher (Wikipedia):

Crushers may be used to reduce the size, or change the form, of waste materials so they can be more easily disposed of or recycled..."

Much like an actual crusher, pyCrusher copies your precious little images and turns them into absolute trash (for fun!)

Install instructions

Pipx

pipx install pycrusher

Uv

uv tool install pycrusher

Pip

pip install pycrusher

Download manually (Linux/MacOS)

git clone https://github.com/jonesmartins/pycrusher
cd pycrusher
python setup.py install

Usage

Type in the command line:

pycrusher <image_file> <flags and parameters>

As default, the program saves your output in a special directory called 'compressions' located at path/to/somewhere, so if you use pyCrusher multiple times in path/to/somewhere, you can check your compressed images without mixing it up between your other files. Every time you save a new file in 'compressions', your output file will be saved with your input name followed by the compression settings. You can still use the -o/--output flag and name it however you want.

Default name: compression/<image-name>_i<iterations>e<extra><r><p><c>[colors].<extension>

Options

usage: pycrusher [-h] [-i ITERATIONS] [-e EXTRA] [-c [COLORS ...]] [-o OUTPUT] [-r] [-p] file

positional arguments:
  file                  Name of image to compress

options:
  -h, --help            show this help message and exit
  -i ITERATIONS, --iterations ITERATIONS
                        Number of compression iterations
  -e EXTRA, --extra EXTRA
                        Number of nested iterations
  -c [COLORS ...], --colors [COLORS ...]
                        Color changes
  -o OUTPUT, --output OUTPUT
                        Name of output file.
  -r, --reverse         Reverses compression iterations.
  -p, --preprocess      Adds color enhancement BEFORE compression.

Examples

Original image: crusher.png

crusher


pycrusher crusher.png

Default output filename: compressions/crusher_i50e1.png

compressed_crusher0


pycrusher crusher.png -i 10

Default output filename: compressions/crusher_i10e1.png

compressed_crusher6


pycrusher crusher.png -i 10 -e 5

Default output filename: compressions/crusher_i10e5.png

compressed_crusher1


pycrusher crusher.png -i 20 -c 4

Default output filename: compressions/crusher_i20e1c[4.0].png

compressed_crusher7


pycrusher crusher.png -i 20 -c 4 -r

Default output filename: compressions/crusher_i20e1rc[4.0].png

compressed_crusher5


pycrusher crusher.png -i 20 -c 4 0

Default output filename: compressions/crusher_i20e1c[4.0,0.0].png

compressed_crusher5


pycrusher crusher.png -i 20 -c 4 0 -p

Default output filename: compressions/crusher_i20e1pc[4.0,0.0].png

compressed_crusher1

License

Apache License 2.0

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

pycrusher-0.3.11.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

pycrusher-0.3.11-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file pycrusher-0.3.11.tar.gz.

File metadata

  • Download URL: pycrusher-0.3.11.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.20

File hashes

Hashes for pycrusher-0.3.11.tar.gz
Algorithm Hash digest
SHA256 a4da28f04ab162a028cd009564950e48886746a4de536c702b86bd03ea37f78b
MD5 8186de25bc0fafcf6f624f87da4593ca
BLAKE2b-256 551eb3f87da594bd04e44ab986a70a8d32045796ed513f5cfbd1b676b50f1780

See more details on using hashes here.

File details

Details for the file pycrusher-0.3.11-py3-none-any.whl.

File metadata

  • Download URL: pycrusher-0.3.11-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.20

File hashes

Hashes for pycrusher-0.3.11-py3-none-any.whl
Algorithm Hash digest
SHA256 ea01b22067bf6ae54bed11a85bf14362efc48b4fd54b46ecd44060de7e6b1e4b
MD5 63b1de532108e328c40b9b78a4123bc1
BLAKE2b-256 6e81aceac44be120cd9622bf4160c30b6aebc4d54878a8baca28c2e4d42f5b66

See more details on using hashes here.

Supported by

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