Skip to main content

GPU-accelerated image processing library for Python

Project description

PyImageCUDA 0.0.7

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.
  • 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.
  • 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.7-cp313-cp313-win_amd64.whl (233.5 kB view details)

Uploaded CPython 3.13Windows x86-64

pyimagecuda-0.0.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (392.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyimagecuda-0.0.7-cp312-cp312-win_amd64.whl (233.4 kB view details)

Uploaded CPython 3.12Windows x86-64

pyimagecuda-0.0.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (392.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyimagecuda-0.0.7-cp311-cp311-win_amd64.whl (233.8 kB view details)

Uploaded CPython 3.11Windows x86-64

pyimagecuda-0.0.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (392.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyimagecuda-0.0.7-cp310-cp310-win_amd64.whl (233.7 kB view details)

Uploaded CPython 3.10Windows x86-64

pyimagecuda-0.0.7-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (392.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cb08a2d34635a58dfe49b576a416a608ba64ff93c64b27cabb107fcf07dd1054
MD5 6a11ea20eb52ee514f8b3db650e9ed44
BLAKE2b-256 dcaa460fd2d626dc80cdd52670ddea7c6a6db4ad4e269208da60004e96157fd3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d3cc363c38f360b728ed26844c93d39a89b9ad80d64169084303880ce5d4fcbe
MD5 06079fbb351d47dc2596c98a6541bf5f
BLAKE2b-256 b937d7eb7fff5d3c04d9445658703fff0400346597e33068cafebf6efdd247f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f4b468dbf4268dc9ecd0f602a205cd7546a4439287d2981f5f6702417a7dd371
MD5 98ef7ae5c7f8e2314dbedcab5b734647
BLAKE2b-256 d81e476a374322a1a32f1eeda7cc847bbf4230db55fc3a523e4af04e7d43354f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f6d22a213934484ffa6eaba0c61fab20d542e6b211624506bf00d2aede023b27
MD5 83ab0103e8ee772b6fb2183c4eef3765
BLAKE2b-256 bed2efcd577f05037350482d69ea2c6d75fdfa847bd0a59e08ebcffe5cfe77cb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bb7e37585d57fa2c7cce5f04f5ce3b64fec6750cac7c6d40f90a4720793d4e95
MD5 294121fa742c00c04a3c7aa4066312b9
BLAKE2b-256 d57fdea938a26ccaf9c034a2706535ea8ab6fb30caf6d086429e562dcf58dbd0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1d6b5a1add3e2dd5389766c2deca3aa95c92d56011aa9feb115b24e985c91042
MD5 790d3603fde204241ddee09b5ecf371e
BLAKE2b-256 d160e328edce80b5ff20e11f1b4057590a49f63b00fed89645e80312807321fe

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d9b4f37068bc721777cf9cf4aec555f8cf8b94450cc36b49ff60d7d4aed66fa8
MD5 fb342eac62a736fb20bc56dd260411db
BLAKE2b-256 00cb3d9d1804dbd13baf9dfe81963a0875d47c7db5d870528238542f1a203e6f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.7-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2b21f7e10fa2655edde17b4c12acd9f00eb83e4a26b4d1bd0be083a990417f3a
MD5 1e2498cff4b1082a1f6c5fc10759dfb8
BLAKE2b-256 bacda737c0689e146948f38f0a58fbeeda6685a78ec523559b24b457c9262cf7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyimagecuda-0.0.7-cp310-cp310-manylinux_2_27_x86_64.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