?
This document uses PHP Chinese website manual Release
import "image/jpeg"
Overview
Index
包jpeg實(shí)現(xiàn)了一個(gè)JPEG圖像解碼器和編碼器。
JPEG在ITU-T T.81中定義:http : //www.w3.org/Graphics/JPEG/itu-t81.pdf。
Constants
func Decode(r io.Reader) (image.Image, error)
func DecodeConfig(r io.Reader) (image.Config, error)
func Encode(w io.Writer, m image.Image, o *Options) error
type FormatError
func (e FormatError) Error() string
type Options
type Reader
type UnsupportedError
func (e UnsupportedError) Error() string
fdct.go huffman.go idct.go reader.go scan.go writer.go
DefaultQuality是默認(rèn)的質(zhì)量編碼參數(shù)。
const DefaultQuality = 75
func Decode(r io.Reader) (image.Image, error)
Decode從r讀取JPEG圖像并將其作為image.Image返回。
func DecodeConfig(r io.Reader) (image.Config, error)
DecodeConfig返回JPEG圖像的顏色模型和尺寸,而不用解碼整個(gè)圖像。
func Encode(w io.Writer, m image.Image, o *Options) error
Encode使用給定的選項(xiàng)將圖像m以JPEG 4:2:0基準(zhǔn)格式寫(xiě)入w。如果傳遞nil * Options,則使用默認(rèn)參數(shù)。
FormatError報(bào)告輸入不是有效的JPEG。
type FormatError string
func (e FormatError) Error() string
Options是編碼參數(shù)。質(zhì)量范圍從1到100,越高越好。
type Options struct { Quality int}
已棄用:Reader已棄用。
type Reader interface { io.ByteReader io.Reader}
UnsupportedError報(bào)告輸入使用有效但未實(shí)現(xiàn)的JPEG功能。
type UnsupportedError string
func (e UnsupportedError) Error() string