--- id: simplejpeg version: "1.9.0" license: MIT license_treatment: permissive maintenance: active --- # simplejpeg — A simple package for fast JPEG encoding and decoding. License: permissive · Maintenance: active · Downloads: 326.1K/mo ## What it is and what it does simplejpeg is a thin wrapper around libturbojpeg that provides fast JPEG encoding and decoding directly from memory. It accepts JPEG data as bytes or any object supporting the buffer protocol, and returns decoded images as numpy arrays in your choice of colorspace (RGB, BGR, GRAY, CMYK, etc.). It also offers functions to inspect JPEG headers without full decompression and to encode numpy arrays back to JPEG with control over quality and color subsampling. The package is designed for developers who prioritize speed and direct memory access over convenience. Unlike Pillow, it avoids the overhead of stream wrappers; unlike OpenCV, it returns images in standard RGB by default and has a smaller footprint. It exposes advanced features of libturbojpeg such as fast DCT modes and direct YUV plane encoding, making it useful for batch processing, video pipelines, and resource-constrained environments. Use it for: - Batch decode thousands of JPEG files into numpy arrays for machine learning pipelines with minimal overhead. - Inspect JPEG dimensions and colorspace metadata at 100000+ images per second without full decompression. - Encode video frames or scientific data to JPEG with fine-grained control over quality and subsampling. - Process YUV420 video frames directly from OpenCV without RGB conversion overhead. - Build high-throughput image servers that need to read and write JPEG data from memory buffers. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Encodes and decodes JPEG images directly to and from memory using libturbojpeg, with support for multiple colorspaces and fast header inspection. Yes, if you need fast JPEG encoding/decoding with direct memory access and are comfortable with a compiled dependency. The medium install friction is offset by pre-built wheels for common platforms and active maintenance. No known vulnerabilities. MIT license is permissive. Not recommended if you need a lightweight pure-Python solution or broad format support beyond JPEG. ## Install pip install simplejpeg uv add simplejpeg poetry add simplejpeg ## Installing simplejpeg Before you install: Medium install friction due to compiled C extension; pre-built wheels cover common platforms (Linux x64/arm64, Windows x64/arm64, macOS 10.9+ x64/arm64) for Python 3.10–3.13. Source builds require cmake and an assembler (nasm or yasm). Actively maintained with recent commits. License in practice: MIT license permits commercial and private use with minimal restrictions; include a copy of the license in distributions. Quickstart: import simplejpeg import numpy as np # Decode from bytes jpeg_bytes = open('image.jpg', 'rb').read() image = simplejpeg.decode_jpeg(jpeg_bytes, colorspace='RGB') # Encode back to JPEG encoded = simplejpeg.encode_jpeg(image, quality=85) Requires numpy; compiled extension requires libturbojpeg at runtime (bundled in wheels on supported platforms). Verify before relying: - Whether the bundled libturbojpeg version in wheels is current and receives security updates independently. - Performance comparison with Pillow and OpenCV under real-world workloads to validate the speed claims in the description. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 326.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags fast JPEG encoding decoding, JPEG to numpy array, libturbojpeg wrapper, memory-based image compression, high-speed JPEG processing, JPEG header inspection, colorspace conversion JPEG, image-processing, performance-critical, numpy-native [View on SkillFed](https://skillfed.io/packages/simplejpeg) · [View on PyPI](https://pypi.org/project/simplejpeg/)