cykooz_resizer
cykooz_resizer is package with the optimized version of image resizing
based on Rust's crate fast_image_resize.
Installation
python3 -m pip install cykooz-resizer
Or with automatically installing Pillow:
python3 -m pip install cykooz-resizer[pillow]
Information
Supported pixel types and available optimisations:
| Format | Description | SSE4.1 | AVX2 | Neon |
|---|---|---|---|---|
| U8 | One u8 component per pixel (e.g. L) |
+ | + | + |
| U8x2 | Two u8 components per pixel (e.g. LA) |
+ | + | + |
| U8x3 | Three u8 components per pixel (e.g. RGB) |
+ | + | + |
| U8x4 | Four u8 components per pixel (e.g. RGBA, RGBx, CMYK) |
+ | + | + |
| U16 | One u16 components per pixel (e.g. L16) |
+ | + | + |
| U16x2 | Two u16 components per pixel (e.g. LA16) |
+ | + | + |
| U16x3 | Three u16 components per pixel (e.g. RGB16) |
+ | + | + |
| U16x4 | Four u16 components per pixel (e.g. RGBA16, RGBx16, CMYK16) |
+ | + | + |
| I32 | One i32 component per pixel |
- | - | - |
| F32 | One f32 component per pixel |
+ | + | - |
| F32x2 | Two f32 components per pixel (e.g. LA32F) |
+ | + | - |
| F32x3 | Three f32 components per pixel (e.g. RGB32F) |
+ | + | - |
| F32x4 | Four f32 components per pixel (e.g. RGBA32F) |
+ | + | - |
Implemented resize algorithms:
- Nearest - is nearest-neighbor interpolation, replacing every pixel with the nearest pixel in the output; for upscaling this means multiple pixels of the same color will be present.
- Convolution with different filters:
- box
- bilinear
- catmull_rom
- mitchell
- gaussian
- lanczos3
- Super sampling - is resizing an image in two steps. The first step uses the "nearest" algorithm. The second step uses "convolution" with a configurable filter.
Usage Examples
Resize Pillow's image
from PIL import Image
from cykooz_resizer import FilterType, ResizeAlg, Resizer, ResizeOptions
resizer = Resizer()
dst_size = (255, 170)
dst_image = Image.new('RGBA', dst_size)
for i in range(1, 10):
image = Image.open('nasa_%d-4928x3279.png' % i)
resizer.resize_pil(image, dst_image)
dst_image.save('nasa_%d-255x170.png' % i)
# Resize using a bilinear filter and ignoring an alpha channel.
image = Image.open('nasa-4928x3279.png')
resizer.resize_pil(
image,
dst_image,
ResizeOptions(
resize_alg=ResizeAlg.convolution(FilterType.bilinear),
use_alpha=False,
)
)
Resize the raw image with an alpha channel
from cykooz_resizer import ImageData, PixelType, Resizer
def resize_raw(width: int, height: int, pixels: bytes):
src_image = ImageData(
width,
height,
PixelType.U8x4,
pixels,
)
resizer = Resizer()
dst_image = ImageData(255, 170, PixelType.U8x4)
# By default, Resizer multiplies and divides by alpha channel
# images with `U8x2`, `U8x4`, `U16x2` and `U16x4` pixels.
resizer.resize(src_image, dst_image)
return dst_image
Change used CPU-extensions
from cykooz_resizer import Resizer, CpuExtensions
resizer = Resizer()
resizer.cpu_extensions = CpuExtensions.sse4_1
...
Resize with using thread-pool
from cykooz_resizer import Resizer, ResizeOptions, ResizerThreadPool
...
thread_pool = ResizerThreadPool(num_threads=6)
resizer = Resizer()
resizer.resize(
src_image,
dst_image,
ResizeOptions(thread_pool=thread_pool),
)
...
Benchmarks
Environment:
- CPU: AMD Ryzen 9 5950X
- RAM: DDR4 4000 MHz
- Ubuntu 24.04 (linux 7.0.0)
- Python 3.12
- Rust 1.97.1
- cykooz_resizer = "4.0" (single-threaded mode)
Other Python libraries used to compare of resizing speed:
- Pillow = "12.3.0" (https://pypi.org/project/Pillow/)
Resize algorithms:
- Nearest
- Convolution with Bilinear filter
- Convolution with Lanczos3 filter
Resize RGBA image 4928x3279 => 852x567
- Source image nasa-4928x3279.png
| Package (time in ms) | nearest | bilinear | lanczos3 |
|---|---|---|---|
| Pillow | 1.22 | 110.44 | 206.34 |
| cykooz_resizer - none | 0.21 | 26.52 | 51.28 |
| cykooz_resizer - sse4_1 | 0.21 | 13.48 | 26.97 |
| cykooz_resizer - avx2 | 0.21 | 10.79 | 26.72 |
Resize grayscale (U8) image 4928x3279 => 852x567
- Source image nasa-4928x3279.png has converted into a grayscale image with one byte per pixel.
| Package (time in ms) | nearest | bilinear | lanczos3 |
|---|---|---|---|
| Pillow | 0.28 | 21.42 | 51.72 |
| cykooz_resizer - none | 0.18 | 5.21 | 12.07 |
| cykooz_resizer - sse4_1 | 0.18 | 2.22 | 5.91 |
| cykooz_resizer - avx2 | 0.18 | 1.78 | 4.35 |
Metadata
Release files for cykooz-resizer 4.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cykooz_resizer-4.0.1.tar.gz | 29.8 kB | Without provenance | Details for cykooz_resizer-4.0.1.tar.gz |
Built distributions (wheels)
Total release size: 36.3 MB
Release files / cykooz_resizer-4.0.1.tar.gz
| Download URL | cykooz_resizer-4.0.1.tar.gz |
|---|---|
| Size | 29.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ffee2213a458b11ec5eb044afc7e169ba9913758a53d357ee8cb8a949e4e386c
|
|
BLAKE2b-256 checksum How to use checksums |
c8f2ce96d7a92da27a45fd7f62552f52421f0b98b28f0369dbf31704c2b5862b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp314-cp314-win_amd64.whl
| Download URL | cykooz_resizer-4.0.1-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c081e67d1d57bac9464f47aafb80b936ed8ef889d25c42784fc55fc922ce30f7
|
|
BLAKE2b-256 checksum How to use checksums |
0ea67a7a869313d4260f2ffafb927bb8a5b5e714b3db405aa7055eeb11191d3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cykooz_resizer-4.0.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
5ca303d4c2bb4c6ae4ff07b175c2cdd02ea943a2fe45c62e23e40588c4141270
|
|
BLAKE2b-256 checksum How to use checksums |
1f9bd4812a24cf77d731cbcc5cbf6707675c25f948f23fb91465f2c0a17b9345
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | cykooz_resizer-4.0.1-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
abef4f4667899391461004fa160d74275abb181d4d6c80d317c6e84fbd74a9af
|
|
BLAKE2b-256 checksum How to use checksums |
2f8c78dbc208574296c6d52097bcc38e7936983e6a265e149c77ba59c5dd950b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp314-cp314-macosx_10_12_x86_64.whl
| Download URL | cykooz_resizer-4.0.1-cp314-cp314-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.14 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
99718b0e172cbdb6937d56244f560f6c60b297b0fdba95fdef0aaffef085809d
|
|
BLAKE2b-256 checksum How to use checksums |
90d08d9ba5c8fffd1591e82da525035db4dadeb08233ecc56ee49ebfaac0be1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp313-cp313-win_amd64.whl
| Download URL | cykooz_resizer-4.0.1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
df59a80b0c0f64ec8d5fc1839938a8882e229f25050ac0a398b3c3b88c93ecc6
|
|
BLAKE2b-256 checksum How to use checksums |
cbc513d72fd59616fa626dfebce677052ccb2121948cdda1c54a5529cb55a978
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cykooz_resizer-4.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
cb45939c40364702230cfc580f655fb8099ba27443d9d30384232b40388b3bc0
|
|
BLAKE2b-256 checksum How to use checksums |
021b402593cf20ecbec7786a14b1ad1d0ee5839ab2af06ae75be13a9c02b1495
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | cykooz_resizer-4.0.1-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
cef513d4759fff1484061a23bc3de90c476efd131dcc50aa4e3b444ea9f21b08
|
|
BLAKE2b-256 checksum How to use checksums |
ff70fcef13a7d558670986f3decf9bf4284baa6a713e7891761271ee4283fd66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp313-cp313-macosx_10_12_x86_64.whl
| Download URL | cykooz_resizer-4.0.1-cp313-cp313-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.13 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
55cbfcb0da88dabb7cdba7ae80491431896594521db20aa1d339a54990329451
|
|
BLAKE2b-256 checksum How to use checksums |
b3997ded811d7f60bc9711d5a5fd9b94571358fc6f3e24fd98ecc3aac6698de4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp312-cp312-win_amd64.whl
| Download URL | cykooz_resizer-4.0.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8e23bd602ba0fb0d47b23fdeeeef87330222d46a6e9caeca63490dcc6aae97cb
|
|
BLAKE2b-256 checksum How to use checksums |
01c6cab3e8eca752fade0e67c70f0aba6d4fd645f4f0652203f652bf91f75f1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cykooz_resizer-4.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
d9f11f1ff9c467f763a49a723dadc1535b23e130fb29038f1e914b7a4422d91d
|
|
BLAKE2b-256 checksum How to use checksums |
525db233be6d12a3e95f364606c860d34f1eff988ff3cc37d7b45d8dc7d54c19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | cykooz_resizer-4.0.1-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fc9248fe877fd82ef3c169f10c4c9a365c4feada3678d845d888dd15b1c1039a
|
|
BLAKE2b-256 checksum How to use checksums |
21071f1878e11a3fe87bcbbe7e855c7f29d156caeac8863532535f69af2c0d58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | cykooz_resizer-4.0.1-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
57d70b2270debf5ea724d561ce761c3476e43c3390859e9b0443e7593279bb92
|
|
BLAKE2b-256 checksum How to use checksums |
72ebf10043a3eee4af2c63bc84e21b5005e7d1045496815106f88a93d2e5d5c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp311-cp311-win_amd64.whl
| Download URL | cykooz_resizer-4.0.1-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
24d5be46d76740cf8ad90fd3ef93ba00ae6b98585eb77a864146b987be153ae2
|
|
BLAKE2b-256 checksum How to use checksums |
81345a3497b647ed325ae5acdf457b4e438055bb2f17432d6512bea25330826b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cykooz_resizer-4.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
3d61ad8dc8840ef818116b08070d1d25a40355ab4b812d52829a92618b9ec8c9
|
|
BLAKE2b-256 checksum How to use checksums |
d9ccd3305c306b11fb6fda4cfa054bc34522bb29b4bd692d54c4c1dcf153f720
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | cykooz_resizer-4.0.1-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
79905f12c122ba70086c200e16c0d4ad7a49be740b127718b24470ed5eb67cb7
|
|
BLAKE2b-256 checksum How to use checksums |
a44c4de1d47c02d33555a759c579bf8e1d2d7a93e8bac8bb4ef2a3b1ed9665a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp311-cp311-macosx_10_12_x86_64.whl
| Download URL | cykooz_resizer-4.0.1-cp311-cp311-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.11 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
31956f382ab58a1f165ad3fa7d12e0982f73dd79be509d7a3e7db178b06e2fb0
|
|
BLAKE2b-256 checksum How to use checksums |
c625e17c96affe43d3caacc1d04ca1b4c3b56a6024c2679cbf1fa114d45ec04d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp310-cp310-win_amd64.whl
| Download URL | cykooz_resizer-4.0.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d8eab27636046eb58cd12420f95aefc1ef7f7839ebdd73c731f74d4060506408
|
|
BLAKE2b-256 checksum How to use checksums |
8600ef40f5ee5cf1db39469948ecb3a9b1167058affa21f96eaa739cb5931bde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cykooz_resizer-4.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
e08c736fef8c2a46728967ac20c31be92a3930a6f9d0e5d5473e561cb067ad8e
|
|
BLAKE2b-256 checksum How to use checksums |
c22f66c5a75a73c9dce0daec305d5707a01403e2357ae3718184222c2e8f6e73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | cykooz_resizer-4.0.1-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
14bd30c7a3cbc1de36653cc37ba530458f97a2bc4297e0fb73fc3404f39b68a1
|
|
BLAKE2b-256 checksum How to use checksums |
3cfcb26729b4fd27dbcce5fd9863b89a7f59a8ec713fea1181bc9951848e9835
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / cykooz_resizer-4.0.1-cp310-cp310-macosx_10_12_x86_64.whl
| Download URL | cykooz_resizer-4.0.1-cp310-cp310-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.10 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
166a6e18ed88522bddee1f76764525d2538ed4c1e9d8a3b18566f65374179d8a
|
|
BLAKE2b-256 checksum How to use checksums |
10b0a2bdd24da73e2562a687a9ec0741e94a35f2449b2b749236f33261bf0a04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for cykooz-resizer 4.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.