{"library":"pyjpegls","title":"pyjpegls","description":"Python wrapper for the CharLS C++ library, providing JPEG-LS lossless and near-lossless image compression. Current version 1.5.1, requires Python >=3.9. Active development with occasional releases.","language":"python","status":"active","last_verified":"Fri May 01","install":{"commands":["pip install pyjpegls"],"cli":null},"imports":["from pyjpegls import encode","from pyjpegls import decode","from pyjpegls import ImageFormat","from pyjpegls import InterleaveMode","from pyjpegls import JpegLSEncoderInfo"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import numpy as np\nfrom pyjpegls import encode, decode, ImageFormat, InterleaveMode\n\n# Create a sample 8-bit grayscale image (height, width)\nimage = np.random.randint(0, 256, size=(256, 256), dtype=np.uint8)\n\n# Encode (lossless by default)\nencoded = encode(image, interleave_mode=InterleaveMode.NONE)\nprint(f\"Encoded size: {len(encoded)} bytes\")\n\n# Decode back\ndecoded = decode(encoded)\nprint(f\"Decoded shape: {decoded.shape}, dtype: {decoded.dtype}\")\n\n# Verify lossless reconstruction\nassert np.array_equal(image, decoded), \"Lossless check failed\"","lang":"python","description":"Encode and decode a grayscale image with default lossless settings.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}