Image utilities with python bindings
Project description
Rusty Image Utils
Port of some slow functions from Python to a Rust library with Python bindings, mainly to experiment with rust-cpython
Published as rusty-img-utils
on pypi for Python 3.5, 3.6 and 3.7 on linux and
macos
Functions
darken_pixels
Darkens all pixels in the image by percentage, specified by amount
. Any pixel
that doesn't have a subpixel below than the cutoff
will be ignored.
import img_utils
img_utils.darken_pixels(
src_path="in_file.jpg",
dst_path="out_file.jpg",
amount=80,
cutoff=200,
)
will take the in_file.jpg
and lower each subpixel of the image by 80%, unless
all the subpixels are above 200.
The RGB pixel 100, 220, 220
will be turned into 20, 44, 44
while 210, 220, 230
will be left alone.
Performance comparison
Testing with 100x100 and 1000x1000 random noise images on a 2018 MBP
darken_pixels
*** Testing small size
Python: 12.46 ms avg (402 runs)
Rust: 1.10 ms avg (4534 runs)
Rust is 11.30x faster for small size
*** Testing normal size
Python: 1138.35 ms avg (5 runs)
Rust: 49.45 ms avg (102 runs)
Rust is 23.02x faster for normal size
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for rusty_img_utils-0.1.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f747f9a5ab4de4e5a768fea85d81a451532da985b40113150455743f41a8e905 |
|
MD5 | df7a51498a380ddb77aa2feec3ffc54b |
|
BLAKE2b-256 | 347cdc14334bd1cf9716f29ca2eabc2a1a1ef8447fb0554a4318d31fa7ebcb9e |
Hashes for rusty_img_utils-0.1.5-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9b336ac93e02dfee9d5b9748d31018c70b0dabf95498dac1b4aa94e439cafe2 |
|
MD5 | 15975dcc35850b44ac145aa912b5bd38 |
|
BLAKE2b-256 | 6334fe5f1e72ce25c3b35f9694452b27f24f5c6c0ad8d0c3a26ae36c72d9bbec |
Hashes for rusty_img_utils-0.1.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12a112c5deddd28ec2923764681c8d06c00b332bb36e1870e73d2203bea330e6 |
|
MD5 | 8c8287fed6af90c83efea35dd53e1863 |
|
BLAKE2b-256 | 967cb2a962c44115f7e9c7dba24089b54b0d5b71a296c57e53eebdde6726286a |
Hashes for rusty_img_utils-0.1.5-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a3779a26cc09e62c3160a3b9f3bf8d67d18a18fedb5f01a35462459b20ab283 |
|
MD5 | d4f21227f8c989bed0ee13644dca42f5 |
|
BLAKE2b-256 | a695032871e7b1f3819546b8879a2a71dccbacf92ab8312d33b058e257ace8fc |
Hashes for rusty_img_utils-0.1.5-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4045faddb0ece4131015b26b0b1f30b01e55d5ac2713d67fb33c6a09bc240ed2 |
|
MD5 | e1925e08129fa954aa6549c80952c6dd |
|
BLAKE2b-256 | 617c39df7d4504eb1d24bbd6c022d711877190bbf13b63f6fbd5df19b0c74ee7 |
Hashes for rusty_img_utils-0.1.5-cp35-cp35m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 505cc192419208078cc9bf6a2ba74bcc1e35280e1204fd8d539827a4d7914d67 |
|
MD5 | 03e52ccf56a1876373e40ed427eb50e3 |
|
BLAKE2b-256 | 342d130842058d176783a4afbf0d8317608103fc8d63d7f0dc8be07efeee280a |