{"id":24744,"library":"turbojpeg","title":"TurboJPEG","description":"Python bindings for libjpeg-turbo using pybind11, providing fast JPEG compression and decompression with access to lossless crop/scale operations. Current version 0.0.2.post1, requires Python >=3.7. Development is slow with only a few releases.","status":"active","version":"0.0.2.post1","language":"python","source_language":"en","source_url":"https://github.com/Dobatymo/turbojpeg-python","tags":["jpeg","libjpeg-turbo","image","compression"],"install":[{"cmd":"pip install turbojpeg","lang":"bash","label":"PyPI install"}],"dependencies":[{"reason":"Dynamic library required for binary wheels not provided on all platforms","package":"libjpeg-turbo","optional":true}],"imports":[{"note":"","wrong":"","symbol":"TurboJPEG","correct":"from turbojpeg import TurboJPEG"}],"quickstart":{"code":"from turbojpeg import TurboJPEG\nimport os\n\n# Initialize TurboJPEG\njpeg = TurboJPEG()\n\n# Read JPEG file and decompress\ninput_file = 'input.jpg'\nwith open(input_file, 'rb') as f:\n    jpeg_data = f.read()\nimg = jpeg.decode(jpeg_data)\n# img is a numpy array (height, width, channels)\n\n# Compress back to JPEG\noutput_file = 'output.jpg'\nwith open(output_file, 'wb') as f:\n    f.write(jpeg.encode(img))\n","lang":"python","description":"Basic JPEG decode and encode using TurboJPEG."},"warnings":[{"fix":"Pin version or monitor for updates.","message":"The package version 0.0.2.post1 is very early and may have API changes without notice. Not recommended for production.","severity":"gotcha","affected_versions":"<1.0"},{"fix":"Install libjpeg-turbo via system package manager (e.g., apt install libjpeg-turbo8-dev) or use Docker.","message":"Platform compatibility: binary wheels are not provided for all platforms (e.g., aarch64, manylinux2014). You may need to install libjpeg-turbo system-wide or build from source.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure numpy and array handling match expected layout.","message":"The 'decode' method returns a numpy array with HWC format (height, width, channels). Some users expect CHW.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"pip install turbojpeg","cause":"Package not installed or installed in wrong environment.","error":"ModuleNotFoundError: No module named 'turbojpeg'"},{"fix":"Install libjpeg-turbo via system package manager (e.g., apt install libturbojpeg0-dev on Ubuntu).","cause":"libjpeg-turbo shared library not found on system.","error":"OSError: libturbojpeg.so: cannot open shared object file: No such file or directory"},{"fix":"Use 'from turbojpeg import TurboJPEG' and ensure version >=0.0.2.","cause":"Wrong import path or outdated version where class was named differently.","error":"AttributeError: module 'turbojpeg' has no attribute 'TurboJPEG'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}