Go image/jpeg: JPEG image decoder and encoder
Answer: Package jpeg implements a JPEG image decoder and encoder.
The format and the API
The JPEG format is defined in ITU-T T.81.
Decode reads an image from an io.Reader.
Encode writes a JPEG image to an io.Writer.
Options can set the quality encoding parameter.
Quality and errors
DefaultQuality is the default quality encoding parameter, and its value is 75.
A FormatError reports that the input is not a valid JPEG.
An UnsupportedError reports that the input uses a valid but unimplemented JPEG feature.
The Reader type in the package is deprecated.
See also
Claims
- id: C1 claim: Package jpeg implements a JPEG image decoder and encoder. source: S1 evidence: "implements a JPEG image decoder and encoder"
- id: C2 claim: JPEG is defined in ITU-T T.81. source: S1 evidence: "JPEG is defined in ITU-T T.81"
- id: C3 claim: DefaultQuality is the default quality encoding parameter. source: S1 evidence: "DefaultQuality is the default quality encoding parameter"
- id: C4 claim: A FormatError reports that the input is not a valid JPEG. source: S2 evidence: "A FormatError reports that the input is not a valid JPEG"
Sources
- [S1] image/jpeg. The Go Authors. https://pkg.go.dev/image/jpeg . License: BSD-3-Clause. Accessed 2026-11-26.
- [S2] image/jpeg source. The Go Authors. https://go.dev/src/image/jpeg/reader.go . License: BSD-3-Clause. Accessed 2026-11-26.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, image/jpeg; The Go Authors, image/jpeg source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, image/jpeg; The Go Authors, image/jpeg source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go image/jpeg: JPEG image decoder and encoder." iinventedlight Library, iil:note:fdwfc0hp, version of 2026-11-26. https://iinventedlight.com/library/notes/go-image-jpeg/. License: CC-BY-4.0.
@misc{iil_note_fdwfc0hp,
author = {{iinventedlight}},
title = {{Go image/jpeg: JPEG image decoder and encoder}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-26},
url = {https://iinventedlight.com/library/notes/go-image-jpeg/},
note = {Permanent ID iil:note:fdwfc0hp. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-image-jpeg.schema.json (schema; CC-BY-4.0)
- go-image-jpeg.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-image-jpeg.md.