The Go Programming Language

Package jpeg

import "image/jpeg"

Package jpeg implements a JPEG image decoder and encoder.

JPEG is defined in ITU-T T.81: http://www.w3.org/Graphics/JPEG/itu-t81.pdf.

Package files

fdct.go huffman.go idct.go reader.go writer.go

Constants

DefaultQuality is the default quality encoding parameter.

const DefaultQuality = 75

func Decode

func Decode(r io.Reader) (image.Image, os.Error)

Decode reads a JPEG image from r and returns it as an image.Image.

func DecodeConfig

func DecodeConfig(r io.Reader) (image.Config, os.Error)

DecodeConfig returns the color model and dimensions of a JPEG image without decoding the entire image.

func Encode

func Encode(w io.Writer, m image.Image, o *Options) os.Error

Encode writes the Image m to w in JPEG 4:2:0 baseline format with the given options. Default parameters are used if a nil *Options is passed.

type FormatError

A FormatError reports that the input is not a valid JPEG.

type FormatError string

func (FormatError) String

func (e FormatError) String() string

type Options

Options are the encoding parameters. Quality ranges from 1 to 100 inclusive, higher is better.

type Options struct {
    Quality int
}

type Reader

If the passed in io.Reader does not also have ReadByte, then Decode will introduce its own buffering.

type Reader interface {
    io.Reader
    ReadByte() (c byte, err os.Error)
}

type UnsupportedError

An UnsupportedError reports that the input uses a valid but unimplemented JPEG feature.

type UnsupportedError string

func (UnsupportedError) String

func (e UnsupportedError) String() string

release.r60.3. Except as noted, this content is licensed under a Creative Commons Attribution 3.0 License.