NVIDIA nvImageCodec CUDA 12

raw JSON →
0.8.0.22 verified Fri May 01 auth: no python

NVIDIA nvImageCodec provides accelerated image encoding and decoding using GPU hardware on CUDA 12 systems. Version 0.8.0.22 is the latest beta release, with a focus on JPEG, JPEG2000, and other formats. The library is under active development with beta releases every few months.

pip install nvidia-nvimgcodec-cu12
error ModuleNotFoundError: No module named 'nvimgcodec'
cause Installed the wrong CUDA variant or package not installed.
fix
Ensure you installed 'nvidia-nvimgcodec-cu12' for CUDA 12.
error RuntimeError: CUDA error: no kernel image is available for execution on the device
cause GPU compute capability is too old for the installed version.
fix
Check GPU compatibility (CC >= 5.0 required for CUDA 12). Use a compatible GPU or downgrade to nvImageCodec for CUDA 11.
error AttributeError: module 'nvimgcodec' has no attribute 'Decoder'
cause Using old API before v0.6.0 where classes had different names.
fix
Update to v0.6.0+ and use 'nvimgcodec.Decoder'.
deprecated The package is beta (v0.8.0.22). API may change without notice in future releases.
fix Pin version and test upgrades.
gotcha Only CUDA 12 is supported. Do not install on CUDA 11 systems or older.
fix Use the appropriate CUDA variant package (e.g., nvidia-nvimgcodec-cu11 for CUDA 11).
breaking The library name changed from 'nvImageCodecs' to 'nvimgcodec' in v0.6.0. Import paths changed accordingly.
fix Use 'import nvimgcodec' instead of old 'import nvImageCodecs'.

Load and decode an image using nvImageCodec.

import nvimgcodec
import numpy as np

# Create encoder/decoder instance
decoder = nvimgcodec.Decoder()

# Open an image file
img = decoder.read('example.jpg')
print(f"Image shape: {img.shape}")