Skip to main content

pyfastblur

Small Python library with a single purpose to apply fast blur to PNG images (libpng backend)

Install

Windows: python -m pip install pyfastblur
Linux:

git clone https://github.com/sertraline/pyfastblur && cd pyfastblur
python3 setup.py build bdist_wheel
cd dist && python3 -m pip install ./pyfastblur*.whl

Usage

# example 1
import pyfastblur
result = pyfastblur.blur("path/to/file.png", radius=24)
# example 2
result = pyfastblur.blur("path/to/file.png",
                         radius=24,
                         enable_gaussian=True)
# enable_gaussian processes the image with gaussian blur instead of box blur (slower)
# example 3
from io import BytesIO
# read image into memory object
obj = BytesIO()
with open("test.png", 'rb') as f:
    obj.write(f.read())
# rewind
obj.seek(0)
result = pyfastblur.blur(obj, radius=24)
# write result to file
with open("output.png", 'wb') as f:
    f.write(result.read())

Speed

Sample image: link (3.55MB)

Code:

import pyfastblur
import time
from io import BytesIO

runs = 6
average = 0.0
for i in range(runs):
    start = time.time()
    # read image into memory object
    obj = BytesIO()
    with open("test.png", 'rb') as f:
        obj.write(f.read())
    # rewind
    obj.seek(0)
    # output: BytesIO object
    out = pyfastblur.blur(obj, radius=64)
    # write to file
    with open("output.png", 'wb') as f:
        f.write(out.read())
    average += (time.time() - start)
average = average / runs

print("Average runtime: %s seconds" % str(average))

Result (Windows): Average runtime: 0.5009152094523112 seconds

Metadata

Release files for pyfastblur 1.3

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

Source distribution (sdist)

Source distribution for pyfastblur 1.3
File Size Uploaded Provenance Actions
pyfastblur-1.3.tar.gz 353.4 kB Without provenance Details for pyfastblur-1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyfastblur 1.3
File Interpreter ABI Platform Actions
pyfastblur-1.3-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for pyfastblur-1.3-cp39-cp39-win_amd64.whl

Total release size: 874.6 kB

Release files / pyfastblur-1.3.tar.gz

Download URL pyfastblur-1.3.tar.gz
Size 353.4 kB
Tags Source
SHA-256 checksum
How to use checksums
abb0c023372c2f8235b6552448ad518f67c5e83cd8e62721e4cceb92b9e91692
BLAKE2b-256 checksum
How to use checksums
b6b42c511cc793ff65693e9aa9e3407f4aa705d4aa5e9f2824f84980a3397059
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2

Release files / pyfastblur-1.3-cp39-cp39-win_amd64.whl

Download URL pyfastblur-1.3-cp39-cp39-win_amd64.whl
Size 521.1 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
36dab684fbedfc2f6d12d380c6d7ff70689312638ea54afe0a93dbe0780d1cb5
BLAKE2b-256 checksum
How to use checksums
abfc598ddc0045b3ab3e2e0c5b0506f26594c0eda947a42748d137e1793fb732
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2

Security for pyfastblur 1.3

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.

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