Description
An IMMENSELY FAST JPEG thumbnailer library API.
Why write this? It’s a convenience library API to using libjpeg to load JPEG images destined to be turned into thumbnails of the original, saving information with these thumbnails, retreiving it and managing to load the image ready for scaling with the minimum of fuss and CPU overhead.
This means it’s insanely fast at loading large JPEG images and scaling them down to tiny thumbnails. It’s speedup will be proportional to the size difference between the source image and the output thumbnail size as a count of their pixels.
It makes use of libjpeg features of being able to load an image by only decoding the DCT coefficients needed to reconstruct an image of the size desired. This gives a massive speedup. If you do not try and access the pixels in a format other than YUV (or GRAY8 if the source is grascale) then it also avoids colorspace conversions as well.
epeg source: https://github.com/mattes/epeg
This module provides Python bindings via CFFI.
Usage
In [1]: import epeg
In [2]: thumbnail_data = epeg.scale_image(
fname, # Path to source JPEG image
width, # Desired thumbnail width
height, # Desired thumbnail height
quality # Desired quality, default: 75)
Benchmarks
Wand
In [1]: from wand.image import Image
In [2]: %timeit Image(filename='/tmp/007.jpg'); img.sample(800, 600); _ = img.make_blob('jpeg')
1 loops, best of 3: 264 ms per loop
PIL/Pillow
In [1]: from PIL import Image
In [2]: %timeit Image.open('/tmp/007.jpg').resize((800, 600)).save('/tmp/foo_thumb.jpg')
1 loops, best of 3: 234 ms per loop
epeg
In [1]: import epeg
In [2]: %timeit epeg.scale_image('/tmp/007.jpg', 800, 600)
10 loops, best of 3: 101 ms per loop
Metadata
Release files for epeg-cffi 0.02
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 | |
|---|---|---|---|---|
| epeg-cffi-0.02.tar.gz | 11.8 kB | Without provenance | Details |
Release files / epeg-cffi-0.02.tar.gz
| Download URL | epeg-cffi-0.02.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a64c3236f8a0f098274959c10c86cb987ee94a5ec4fb7c354ba7d026a2e76fe9
|
|
BLAKE2b-256 checksum How to use checksums |
0016291af5c6dd0d4ffe52843afbddb0c460436176bc40caae028e878d97eaf8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for epeg-cffi 0.02
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.