Skip to main content

GPU-accelerated image processing library for Python

Project description

PyImageCUDA 0.0.9

PyPI version Build Status Python Platform Tests NVIDIA

GPU-accelerated image compositing for Python.

PyImageCUDA is built for image composition, not computer vision. It provides GPU tools to create, modify, and blend images, rather than analyze or recognize objects within them.

Quick Example

Demo
from pyimagecuda import Image, Fill, Effect, Blend, Transform, save

with Image(1024, 1024) as bg:
    Fill.color(bg, (0, 1, 0.8, 1))
    with Image(512, 512) as card:
        Fill.gradient(card, (1, 0, 0, 1), (0, 0, 1, 1), 'radial')
        Effect.rounded_corners(card, 50)

        with Effect.stroke(card, 10, (1, 1, 1, 1)) as stroked:
            with Effect.drop_shadow(stroked, blur=50, color=(0, 0, 0, 1)) as shadowed:
                with Transform.rotate(shadowed, 45) as rotated:
                    Blend.normal(bg, rotated, anchor='center')

    save(bg, 'output.png')

Key Features

  • Zero Dependencies: No CUDA Toolkit, Visual Studio, or complex compilers needed. Is Plug & Play on both Windows and Linux.
  • Ultra-lightweight: library weighs ~1 MB.
  • Studio Quality: 32-bit floating-point precision (float32) to prevent color banding.
  • Advanced Memory Control: Reuse GPU buffers across operations and resize without reallocation—critical for video processing and batch workflows.
  • OpenGL Integration: Direct GPU-to-GPU display for real-time preview widgets.
  • API Simplicity: Intuitive, Pythonic API designed for ease of use.

Use Cases

  • Generative Art: Create thousands of unique variations in seconds.
  • Motion Graphics: Process video frames or generate effects in real-time.
  • Image Compositing: Complex multi-layer designs with GPU-accelerated effects.
  • Node Editors & Real-time Tools: Build responsive image editors with instant preview.
  • Game Development: Procedural UI assets, icons, and sprite generation.
  • Marketing Automation: Mass-produce personalized graphics from templates.
  • Data Augmentation: High-speed batch transformations for ML datasets.

Installation

pip install pyimagecuda

Note: pyvips is the only mandatory dependency (installed automatically). It is used strictly for robust file I/O (JPG, PNG, WEBP...) and high-quality Text rendering on the CPU.

Documentation

⚠️ Alpha Release: Many more features are planned and under development. If you have specific needs or bug reports, please open an issue on GitHub.

Core Concepts

Operations

  • Fill (Solid colors, Gradients, Checkerboard, Grid, Stripes, Dots, Circle, Ngon, Noise, Perlin)
  • Text (Rich typography, system fonts, HTML-like markup, letter spacing...)
  • Blend (Normal, Multiply, Screen, Add, Overlay, Soft Light, Hard Light, Mask)
  • Resize (Nearest, Bilinear, Bicubic, Lanczos)
  • Adjust (Brightness, Contrast, Saturation, Gamma, Opacity)
  • Transform (Flip, Rotate, Crop)
  • Filter (Gaussian Blur, Sharpen, Sepia, Invert, Threshold, Solarize, Sobel, Emboss)
  • Effect (Drop Shadow, Rounded Corners, Stroke, Vignette)

Performance

PyImageCUDA shows significant speedups for GPU-friendly operations like blending, filtering, and transformations. Performance varies by operation complexity and workflow:

  • Complex operations (blur, blend, rotate) see 10-260x improvements
  • Simple operations (flip, crop) see 3-20x improvements
  • Real-world pipelines with file I/O typically see 1.5-2.5x speedups

Results depend on your hardware, batch size, and whether you reuse GPU buffers.

→ View Detailed Benchmarks

Requirements

  • OS:
    • Windows 10 or 11 (64-bit).
    • Linux: Any modern distribution (Ubuntu, Fedora, Debian, Arch, WSL2, etc.).
  • GPU: NVIDIA GPU (Maxwell architecture / GTX 900 series or newer).
  • Drivers: Standard NVIDIA Drivers installed.

NOT REQUIRED: Visual Studio, CUDA Toolkit, or Conda.

Linux Compatibility & Troubleshooting

PyImageCUDA is currently tested primarily on Ubuntu LTS releases with up-to-date NVIDIA drivers.

If you encounter the following error on Linux:

RuntimeError: Kernel launch failed: the provided PTX was compiled with an unsupported toolchain.

Solution: This indicates your installed NVIDIA drivers are too old to execute the kernels included in the library. Please update your NVIDIA drivers to the latest version available for your distribution (Proprietary drivers recommended).

We are actively investigating ways to broaden compatibility for older drivers and legacy Linux distributions in future releases.

Tests

pytest tests/tests.py

Contributing

Contributions welcome! Open issues or submit PRs

License

MIT License. See LICENSE for details.

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyimagecuda-0.0.9-cp313-cp313-win_amd64.whl (236.7 kB view details)

Uploaded CPython 3.13Windows x86-64

pyimagecuda-0.0.9-cp313-cp313-manylinux_2_28_x86_64.whl (643.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pyimagecuda-0.0.9-cp312-cp312-win_amd64.whl (236.7 kB view details)

Uploaded CPython 3.12Windows x86-64

pyimagecuda-0.0.9-cp312-cp312-manylinux_2_28_x86_64.whl (643.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pyimagecuda-0.0.9-cp311-cp311-win_amd64.whl (237.0 kB view details)

Uploaded CPython 3.11Windows x86-64

pyimagecuda-0.0.9-cp311-cp311-manylinux_2_28_x86_64.whl (643.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

pyimagecuda-0.0.9-cp310-cp310-win_amd64.whl (237.0 kB view details)

Uploaded CPython 3.10Windows x86-64

pyimagecuda-0.0.9-cp310-cp310-manylinux_2_28_x86_64.whl (643.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

File details

Details for the file pyimagecuda-0.0.9-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pyimagecuda-0.0.9-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 236.7 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyimagecuda-0.0.9-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d9fc5015796b6e0f2dee0b533301658a7425f0153ec7722f313bc263908a9c56
MD5 777bc6b318ed617c009effda49a4a436
BLAKE2b-256 50433e695f7a55f7c6fd24223fc10c6c2e2e39a166e2277adfd3634719b9b74f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.0.9-cp313-cp313-win_amd64.whl:

Publisher: build.yml on offerrall/pyimagecuda

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyimagecuda-0.0.9-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.0.9-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ae880a32ee0958a850e9defd06790a39561817f3f6b12ef2f9a9f9947291862b
MD5 ec4428444c921a1bc7840167869c4184
BLAKE2b-256 a6c2304d5e68699eec1e596af866eeb6bd4bb62db9dc2b3b07f1db30c39b1b5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.0.9-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: build.yml on offerrall/pyimagecuda

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyimagecuda-0.0.9-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pyimagecuda-0.0.9-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 236.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyimagecuda-0.0.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4a0a01f33d302f5b4639e403a81b0e2c1e0fbd071a5170db6daf8d4314d071fc
MD5 f5951d49e24b0eed8b4ae451a94fbeec
BLAKE2b-256 b79dd83eb28808b70ffd045a2fe895ce6c73630a4b046098b3d88727e53e5cb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.0.9-cp312-cp312-win_amd64.whl:

Publisher: build.yml on offerrall/pyimagecuda

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyimagecuda-0.0.9-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.0.9-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 60bb9dae094f55181eb68f11c72b0b648511191b8a6f81ec3eafa6176f45de63
MD5 3ad361acde6886d9a4b3f139ce4a3148
BLAKE2b-256 c61356a940ac245bb50b3d9995a429387ede5f66ebd762d25e0ef1e5137ae5fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.0.9-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: build.yml on offerrall/pyimagecuda

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyimagecuda-0.0.9-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pyimagecuda-0.0.9-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 237.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyimagecuda-0.0.9-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 73575bb0a5fa5c392c6c59e7c42be1b128dbe939873a9f5e166772e86c68f80b
MD5 43425ccf7cf4f18390297d846fef4662
BLAKE2b-256 45287bc0b776f87d240f2fdf5f190e05d90a6be4d7a78462aa60fa0c0dd8a6de

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.0.9-cp311-cp311-win_amd64.whl:

Publisher: build.yml on offerrall/pyimagecuda

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyimagecuda-0.0.9-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.0.9-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fd5f182574cc6758e0493083ae99b2e5894c5428958eec18a7539e5eaeaa2371
MD5 a06ab73f8dcb2846d90adb187174feb7
BLAKE2b-256 1c4868d7521f1478eda8e0334e10bac977a011175b1023a8372defb38e9c2033

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.0.9-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: build.yml on offerrall/pyimagecuda

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyimagecuda-0.0.9-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pyimagecuda-0.0.9-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 237.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyimagecuda-0.0.9-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cbbd385cf735feed87d887e0b506609f6d954ce782abcf22fd737c4c00b2b15e
MD5 ae97cf53c42e10b03d3437a53224d280
BLAKE2b-256 570d0cda456e1e29f715d6e4774e2c748ae5faefbf5c83030030a5b44526aecf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.0.9-cp310-cp310-win_amd64.whl:

Publisher: build.yml on offerrall/pyimagecuda

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyimagecuda-0.0.9-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.0.9-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0f49eb306bc8f8c4acc992e16a023e15ca70bcb74c807d8b4a79088c7ae7b5d6
MD5 f0f318243520e9730743e16704781e32
BLAKE2b-256 a304676ce9babc5285266a793acecc1af4dcf4e59e6ddb8005db569e7a639f27

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.0.9-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: build.yml on offerrall/pyimagecuda

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page