Skip to main content

GPU-accelerated image processing library for Python

Project description

PyImageCUDA 0.0.8

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

Uploaded CPython 3.13Windows x86-64

pyimagecuda-0.0.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (392.8 kB view details)

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

pyimagecuda-0.0.8-cp312-cp312-win_amd64.whl (233.8 kB view details)

Uploaded CPython 3.12Windows x86-64

pyimagecuda-0.0.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (392.8 kB view details)

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

pyimagecuda-0.0.8-cp311-cp311-win_amd64.whl (234.1 kB view details)

Uploaded CPython 3.11Windows x86-64

pyimagecuda-0.0.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (392.8 kB view details)

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

pyimagecuda-0.0.8-cp310-cp310-win_amd64.whl (234.1 kB view details)

Uploaded CPython 3.10Windows x86-64

pyimagecuda-0.0.8-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (392.8 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.8-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyimagecuda-0.0.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c78e647eb1012e508b95ceffccfce8f9258be522daf677e790289ad0dc55b9c4
MD5 ccf9988daaf101a07f9ef05a9dbedf2c
BLAKE2b-256 71d31cbb9c3292fc67ef016496c8c90deec05852fb632d348571d8bb6da887db

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a53593e961d28ec958382da86925a4d168b9ac21160ad495017c756b1c1f0305
MD5 3642acab6d0d90e124041aee24e0bdd3
BLAKE2b-256 541c1f1ed43ca2d0560c1c1a64660fbd05cc1e5e939c3598b346f6d0215ae7cd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bc82ad16ccfbd993063938dd0c1351c7580072aed7a71b421752bcf8b931cd53
MD5 b1943ec7d8483f7075d38a13cf787ce5
BLAKE2b-256 a7e1440e9b6e36043beb47f835c6164c6dd1ed56be68a5b64b3d2753000c6194

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 97e0b5471770b2d97031509477a00b7999e768534fb4562e3365b49817d1a59f
MD5 eaf66239c2b8128958bc967200b6076c
BLAKE2b-256 e2264744e040b97f63250585a425a5e71481c9d14ca086488f68d29fbbaff08b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7db86ee580e0dd8eff62bf3bf3b9654027abc04f0ca3719a7c0bc2faff3094cf
MD5 0d6ac618f67a4ebfe9dc9cd4ffd869b0
BLAKE2b-256 b442ef9e7fa5c9803a8d87f50c7a8b8ae9f875fc7d50b0664308f42f0a69841f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 44777777fd518dc6d9fe2222a450ee12d65b62d6c36c1884f81ede55c1b1874f
MD5 e7fd58de069e949a44f2ffac816d2378
BLAKE2b-256 37ad7db32779ed78b9790c14b6751541569aa2273863d5ec8e280b7adc73abeb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 859e844a08dcd674715d73186a82e9f1e70f1d691c5b366fd7c8033fbba82497
MD5 b44d485499eeef53b36a22d4041aa4a3
BLAKE2b-256 5c5728b419fa5d435c2b2ef5490e3db6ec568600319375062af04a96cbf583d2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyimagecuda-0.0.8-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 570cfa0a38958f8b342a7b5e807dbca735f38ff01c82c03d2bb07695bcabbb58
MD5 ff90aa71e6650f30ee2c44ecfca1e130
BLAKE2b-256 059379fe83bf4041dedeb434aca161c87e80fd4da0133080c893fb91a480968b

See more details on using hashes here.

Provenance

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