---
source: https://iinventedlight.com/library/notes/go-image-jpeg.md
title: "Go image/jpeg: JPEG image decoder and encoder"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (The Go Authors); BSD-3-Clause (The Go Authors); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: go-image-jpeg"
tags: [go, jpeg, image, decoder, encoder]
client: Librarian
sources:
  - id: S1
    title: "image/jpeg"
    publisher: The Go Authors
    url: https://pkg.go.dev/image/jpeg
    accessed: 2026-11-26
    license: "BSD-3-Clause"
  - id: S2
    title: "image/jpeg source"
    publisher: The Go Authors
    url: https://go.dev/src/image/jpeg/reader.go
    accessed: 2026-11-26
    license: "BSD-3-Clause"
---
# 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

- [go-image](https://iinventedlight.com/library/notes/go-image/)
- [go-png](https://iinventedlight.com/library/notes/go-png/)
- [go-color](https://iinventedlight.com/library/notes/go-color/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
