Skip to main content

GPU-accelerated image processing library for Python

Project description

PyImageCUDA 0.1.0

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.

PyImageCUDA Ecosystem

This library is the foundation. For visual workflows:

PyImageCUDA Studio

  • Node-based image compositor with real-time preview
  • Design templates visually, automate with Python
  • 40+ nodes: generators, effects, filters, transforms
  • Headless batch processing API
pip install pyimagecuda-studio

Installation

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

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, Zoom)
  • 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.1.0-cp313-cp313-win_amd64.whl (481.1 kB view details)

Uploaded CPython 3.13Windows x86-64

pyimagecuda-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl (890.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pyimagecuda-0.1.0-cp312-cp312-win_amd64.whl (481.1 kB view details)

Uploaded CPython 3.12Windows x86-64

pyimagecuda-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl (890.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pyimagecuda-0.1.0-cp311-cp311-win_amd64.whl (481.4 kB view details)

Uploaded CPython 3.11Windows x86-64

pyimagecuda-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (890.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

pyimagecuda-0.1.0-cp310-cp310-win_amd64.whl (481.4 kB view details)

Uploaded CPython 3.10Windows x86-64

pyimagecuda-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl (890.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

File details

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

File metadata

File hashes

Hashes for pyimagecuda-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4b073c585bbea57afe6b1abfb47732f7c6f8ed81adb520c80adde5d1c6934a7f
MD5 da5289fa8212a598f8365a8839c84539
BLAKE2b-256 790eb237149825d8c981404407daf4f066fe2f12106d42fd8df51d93823c6fce

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.1.0-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.1.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3d3cc66a434308e5586ad13c6a10fea9d0dbf982020a73c90cad96ad407a3ea8
MD5 62cc1f92d94f58d7ca46ce41cf36efd8
BLAKE2b-256 06c07185c5312d89fdd57042790a319745f17d36e9047df08c99da5152125363

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.1.0-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.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a694ed41a7cd1235b989ef4b16eef1ff52e821183dbcc90873b675109a568836
MD5 938c118fa6e79eba10abe74d7a3b61fe
BLAKE2b-256 f3c46866736b80ae623ad85b33ea62a276b75b9a370bbc8557a1c41392b15b40

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.1.0-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.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c075bb793a51a9b707b57c0af2c59ebc4e6867af29d94d7eb0fd44bdc6982021
MD5 b43b74bf4656b00675cb5833b6ce44dd
BLAKE2b-256 2674927fdd54ba15e05b79cdf4be4ac1477883b81fd658872c70590c2e5fa9a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.1.0-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.1.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b47eb3b6eaa7ee4880f95bdf7004bf38a16460992edd41f6ee17023f4e81f9fb
MD5 e2e27d16d864b49821798c85173852f8
BLAKE2b-256 4c0d4433adc346faf139cae44e49d9967505de78271fe45959567c09bfb26e26

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.1.0-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.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b0510137fa740a247791a94c9d0821861d0754b7cfe2c19d57134e7ef2a61928
MD5 cb58a79cbd87ed777470b8d43e289681
BLAKE2b-256 339e0b44c5131c40c0984ab55a4349712471eadad1c92a984c78dd28e0c7f861

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.1.0-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.1.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2c5a07035ae97fe85edaa56cff9e5fd0a50b5984b1462e5611a6eadafc11a8c1
MD5 4a93c5fe70601783a7477639e5d253ef
BLAKE2b-256 8472fccdec5109fb6634e8a7eee47190b2bc68a2c45910a5cf35107933961625

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.1.0-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.1.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3ce9791ca5bcc812c5964e71ba82605964494ee33dd15ffcea435503a9b20422
MD5 ac64884ed060884c8db900f8fa04bc4b
BLAKE2b-256 16423977baa4da23da1cb4b2d63794d0bcdf29b7324b6c15f61655f7e7b1fe4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.1.0-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