Skip to content
ufraan
← Back

Jpeg Go

A from-scratch jpeg encoder & decoder written in go. No external dependencies, just the standard library.

GoLibraryImage Processing
Mar 2026GitHubLive

A from-scratch JPEG encoder and decoder in Go with zero external dependencies, taking raw RGB pixel data through the full compression pipeline and back. It supports configurable quality settings from 1 to 100, which control the quantization tables and directly affect file size and visual fidelity. Every stage of the JPEG standard is implemented manually as a learning exercise in image compression.

JPEG compression pipeline visualization
JPEG compression pipeline visualization

The pipeline follows the standard JPEG flow: RGB to YCbCr conversion, chroma subsampling, DCT on 8x8 blocks, quantization, zigzag reordering, run-length encoding, and Huffman coding. Everything uses only the Go standard library, including bitstream manipulation via bufio.