skillfed

simplejpeg

A simple package for fast JPEG encoding and decoding.

simplejpeg v1.9.0 326.1K downloads/30d#7,579 on PyPI10
Permissive license MIT Active released

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 on this page — 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

simplejpeg on PyPI

pip

pip install simplejpeg

uv

uv add simplejpeg

poetry

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 the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 308 days since the last release
Last repo commit
First released
Downloads 326,134/month — #7,579 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: simplejpeg-1.9.0-cp310-cp310-macosx_10_9_x86_64.whl; simplejpeg-1.9.0-cp310-cp310-macosx_11_0_arm64.whl; simplejpeg-1.9.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; simplejpeg-1.9.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; simplejpeg-1.9.0-cp310-cp310-win_amd64.whl; simplejpeg-1.9.0-cp311-cp311-macosx_10_9_x86_64.whl; simplejpeg-1.9.0-cp311-cp311-macosx_11_0_arm64.whl; simplejpeg-1.9.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; simplejpeg-1.9.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; simplejpeg-1.9.0-cp311-cp311-win_amd64.whl; simplejpeg-1.9.0-cp311-cp311-win_arm64.whl; simplejpeg-1.9.0-cp312-cp312-macosx_10_13_x86_64.whl; simplejpeg-1.9.0-cp312-cp312-macosx_11_0_arm64.whl; simplejpeg-1.9.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; simplejpeg-1.9.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; simplejpeg-1.9.0-cp312-cp312-win_amd64.whl; simplejpeg-1.9.0-cp312-cp312-win_arm64.whl; simplejpeg-1.9.0-cp313-cp313-macosx_10_13_x86_64.whl; simplejpeg-1.9.0-cp313-cp313-macosx_11_0_arm64.whl; simplejpeg-1.9.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Keywords: the, fastest, JPEG, encoding, decoding, package, in, town

Development Status :: 5 - Production/StableIntended Audience :: Science/Research

Tags

fast JPEG encoding decodingJPEG to numpy arraylibturbojpeg wrappermemory-based image compressionhigh-speed JPEG processingJPEG header inspectioncolorspace conversion JPEG
image-processingperformance-criticalnumpy-native

More Graphics packages