Fast image compression for large number of images with Ray library.
Project description
Ray-Image
🚀 Fast image compression for large number of images with Ray library.
Requirements
To install ray
, run*:
pip install ray
*For Apple Silicon (M1), follow the instructions here to install ray
.
⬇️ Installation
pip install rayim
⌨️ Usage
usage: rayim [-h] [-o OUTPUT_DIR] [-q QUALITY] [--overwrite] [-N] [-j] [-s]
path [path ...]
positional arguments:
path Path to a single file/directory or multiple
files/directories
optional arguments:
-h, --help show this help message and exit
-o OUTPUT_DIR, --output-dir OUTPUT_DIR
Output directory (default: next to original file)
-q QUALITY, --quality QUALITY
Output image quality (JPEG only; default: 70)
--overwrite Overwrite the original image
-N, --no-subsampling Turn off subsampling and retain the original image
setting (JPEG only)
-j, --to-jpeg Convert the image(s) to .JPEG
-s, --silent Silent mode
📕 Examples
- Running on a single file:
rayim foo.jpg
# 🚀 foo.jpg: 1157. kB ==> 619.9 kB (-46.4%) | 0.07s
- Running on a folder
foo
and writing the output tocompressed
rayim foo/ -o compressed
# (compress_many pid=612778) 🚀 foo.jpg: 988.9 kB ==> 544.8 kB (-44.9%) | 0.08s
# (compress_many pid=612828) 🚀 bar.jpg: 983.7 kB ==> 541.2 kB (-44.9%) | 0.07s
# (compress_many pid=612826) 🚀 foobar.jpg: 1001. kB ==> 550.7 kB (-44.9%) | 0.07s
# (compress_many pid=612786) 🚀 barfoo.jpg: 1001. kB ==> 551.9 kB (-44.8%) | 0.08s
# ...
# Total:
# Before: 1091.32 MB
# After: 599.46 MB (-45.0%)
Speed comparison
Test 1 (on Apple Silicon M1, 8-cores)
Method | Number of files | Speed |
---|---|---|
Regular compression | 1,000 | 60.090s |
rayim | 1,000 | 26.937s (55.17% faster) |
Total:
Before: 1091.32 MB
After: 599.46 MB (-45.0%)
Test 2 (on Intel @ 2.299GHz, 32-cores)
Method | Number of files | Speed |
---|---|---|
Regular compression | 6,000 | 7m42.919s |
rayim | 6,000 | 5m15.423s (31.96% faster) |
Total:
Before: 6040.59 MB
After: 3321.70 MB (-45.0%)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rayim-0.9.0.tar.gz
(5.7 kB
view details)
Built Distribution
rayim-0.9.0-py3-none-any.whl
(5.9 kB
view details)
File details
Details for the file rayim-0.9.0.tar.gz
.
File metadata
- Download URL: rayim-0.9.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.10 Darwin/21.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5df175d024beaefef5e2fdc4166e2c83076af05503e45a6b90c0528dc6fc129 |
|
MD5 | 212e97f0da67d20826833ecbbc04bd28 |
|
BLAKE2b-256 | 7dbc062117f68222687629fe3bba6c1e4730f804def83b3a5de802dca530d03f |
File details
Details for the file rayim-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: rayim-0.9.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.10 Darwin/21.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9879e0750b8cbe2b91c45ab692d02c2d68a14569c00c0eab5af594fec498b568 |
|
MD5 | 2e89e928e7840fae38a9874847a651bb |
|
BLAKE2b-256 | 5cf80ce5ecad67b87f050954e7463e386e298cf56e332eccdf8882036fdb2966 |