Registry / ai-ml / nvidia-nvjpeg2k-cu12

nvidia-nvjpeg2k-cu12

JSON →
library0.10.0.49pypypi✓ verified 90d ago

NVIDIA native runtime libraries for JPEG 2000 encoding and decoding using GPU acceleration via CUDA 12. The current version is 0.10.0.49, requires Python >=3. It provides a Python wrapper around the nvJPEG2000 library. Release cadence is linked to NVIDIA driver updates.

pip install nvidia-nvjpeg2k-cu12
INSTALL
IMPORT
SIG · NVIDIA-NVJPEG2K-CU
N
nvidia-nvjpeg2k-cu12
ai-mlpythonv0.10.0.49
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

nvjpeg2k
✓ from nvidia import nvjpeg2k
✗ import nvjpeg2k
Top-level import fails; must import from nvidia subpackage.
Jpeg2kDecoder
✓ from nvidia.nvjpeg2k import Jpeg2kDecoder
✗ from nvjpeg2k import Jpeg2kDecoder
Wrong module path: omit 'nvidia.' prefix.
Jpeg2kEncoder
✓ from nvidia.nvjpeg2k import Jpeg2kEncoder
Correct import path.

Demonstrates basic JPEG2000 decode and encode operations using numpy arrays.

import numpy as np from nvidia import nvjpeg2k from nvidia.nvjpeg2k import Jpeg2kDecoder, Jpeg2kEncoder # Decode a JPEG2000 file with open('input.j2k', 'rb') as f: compressed_data = f.read() decoder = Jpeg2kDecoder() decoded = decoder.decode(compressed_data) print(f"Decoded shape: {decoded.shape}, dtype: {decoded.dtype}") # Encode an image (e.g., random grayscale) image = np.random.randint(0, 256, (256, 256), dtype=np.uint8) encoder = Jpeg2kEncoder() compressed = encoder.encode(image, quality=95) print(f"Compressed size: {len(compressed)} bytes")
Debug
Known issues
gotchaEnsure you have a compatible NVIDIA GPU and CUDA 12 driver installed. The library does not include the CUDA driver; it expects a system-wide installation.
fix
Verify with `nvidia-smi` that CUDA version >=12.0 and a supported GPU are present.
affects: all
breakingThe import path changed from `import nvjpeg2k` (older versions) to `from nvidia import nvjpeg2k` starting with the nvidia-nvjpeg2k-cu12 package. Direct top-level import will raise ModuleNotFoundError.
fix
Use `from nvidia import nvjpeg2k` instead of `import nvjpeg2k`.
affects: 0.10.0.x
gotchaThe library expects compressed data as bytes for decoding. Passing a numpy array or file handle without reading binary will fail.
fix
Always read file as binary (`open(path, 'rb').read()`) or use bytes object.
affects: all
deprecatedDirect use of `nvjpeg2k.Jpeg2kDecoder` without context manager might cause resource leaks in long-running applications. Consider using context managers or explicit `destroy()`.
fix
Wrap decoder usage in `with Jpeg2kDecoder() as decoder:` if available; otherwise call `decoder.destroy()` after use.
affects: 0.10.0.x
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'nvjpeg2k'
Importing without the 'nvidia' prefix.
fix
Use `from nvidia import nvjpeg2k` or `from nvidia.nvjpeg2k import Jpeg2kDecoder`.
RuntimeError: nvJPEG2K error: Invalid parameter value
Invalid image dimensions or quality parameters (e.g., non-integer quality, or image not on GPU memory when required).
fix
Ensure image is a numpy array of uint8, uint16, or float32, and dimensions are multiples of 1 (check encoder docs for specific constraints). For quality, use integer 0-100.
RuntimeError: nvJPEG2K error: Insufficient memory
Image resolution too high for available GPU memory.
fix
Reduce image size or use a GPU with more memory. Alternatively, decode in strips if supported.
Upgrade
Version history
0.10.0.49latest on PyPI · released Apr 6, 2026
Audit
Dependencies
cuda-pythonrequiredRequired for CUDA context management and device handling
numpyrequiredUsed for array conversion when decoding/encoding image data
Agent activity
4 hits · last 30 days
node
4
Resources
nvidia-nvjpeg2k-cu12 — pip install nvidia-nvjpeg2k-cu12 · libregistry