{"library":"nvidia-nvjpeg2k-cu12","title":"NVIDIA nvJPEG2000 CUDA 12","description":"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.","language":"python","status":"active","last_verified":"Sat May 09","install":{"commands":["pip install nvidia-nvjpeg2k-cu12"],"cli":null},"imports":["from nvidia import nvjpeg2k","from nvidia.nvjpeg2k import Jpeg2kDecoder","from nvidia.nvjpeg2k import Jpeg2kEncoder"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import numpy as np\nfrom nvidia import nvjpeg2k\nfrom nvidia.nvjpeg2k import Jpeg2kDecoder, Jpeg2kEncoder\n\n# Decode a JPEG2000 file\nwith open('input.j2k', 'rb') as f:\n    compressed_data = f.read()\n\ndecoder = Jpeg2kDecoder()\ndecoded = decoder.decode(compressed_data)\nprint(f\"Decoded shape: {decoded.shape}, dtype: {decoded.dtype}\")\n\n# Encode an image (e.g., random grayscale)\nimage = np.random.randint(0, 256, (256, 256), dtype=np.uint8)\nencoder = Jpeg2kEncoder()\ncompressed = encoder.encode(image, quality=95)\nprint(f\"Compressed size: {len(compressed)} bytes\")","lang":"python","description":"Demonstrates basic JPEG2000 decode and encode operations using numpy arrays.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}