Skip to main content

Ray-Image

🚀 Fast image compression for large number of images with Ray library.

Supported Python versions PEP8 Poetry-build

Requirements

To install ray, run:

pip install ray

⬇️ Installation

pip install rayim

⌨️ Usage

usage: rayim [-h] [-o OUTPUT_DIR] [-q QUALITY] [--overwrite] [-n] [-j]
             [--replicate-dir-tree] [-s SIZE SIZE] [-d DIV_BY] [-S] [-O]
             path [path ...]

positional arguments:
  path                  Path to a single file/directory or multiple
                        files/directories

options:
  -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
  --replicate-dir-tree  Replicate the source directory tree in the output
  -s SIZE SIZE, --size SIZE SIZE
                        Resize the image to WIDTH HEIGHT
  -d DIV_BY, --div-by DIV_BY
                        Divide the image size (WxH) by a factor of n
  -S, --silent          Silent mode
  -O, --optimize        Apply default optimization on the image(s)
  -k, --keep-date       Keep the original modification date

📕 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 to compressed
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.8 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%)

Release files for rayim 1.9.1

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

Source distribution (sdist)

Source distribution for rayim 1.9.1
File Size Uploaded
rayim-1.9.1.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rayim 1.9.1
File Interpreter ABI Platform
rayim-1.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / rayim-1.9.1.tar.gz

Download URL rayim-1.9.1.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
96b6e2dc1f43f5bec6cb99b77bfdc1ff36508df17d60ed2cc870c2ba4d059a9b
BLAKE2b-256 checksum
How to use checksums
bb1c18e21cc5a488c450618b9aad8859a85cb3c8940068735ca1b3fc2a55fdf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.8 Darwin/25.5.0

Release files / rayim-1.9.1-py3-none-any.whl

Download URL rayim-1.9.1-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f30d5e74bbffb8c1753eb25326c07552ea8c81a731935a560e1af2b8c09664b0
BLAKE2b-256 checksum
How to use checksums
99f260d939cd3d8ac0c54d3a5ebf0abd668be46cd98f71189735602f7fc13938
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.8 Darwin/25.5.0

Release history Release notifications | RSS feed

This release

1.9.1 This release

2 release files

1.9.0

2 release files

1.8.4

2 release files

1.8.3

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.9.0

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