← All notes

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

Sources

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

Permanent ID: iil:note:fdwfc0hp

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.},
}

Markdown

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.

All artifact files (JSON index)

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.