jpeg包实现了jpeg图片的编码和解码
func Decode(r io.Reader) (image.Image, error) //Decode读取一个jpeg文件,并将他作为image.Image返回
func DecodeConfig(r io.Reader) (image.Config, error) //无需解码整个图像,DecodeConfig变能够返回整个图像的尺寸和颜色(Config具体定义查看gif包中的定义)
func Encode(w io.Writer, m image.Image, o *Options) error //按照4:2:0的基准格式将image写入w中,如果options为空的话,则传递默认参数
type Options struct {
Quality int
}
Options是编码参数,它的取值范围是1-100,值越高质量越好
type FormatError //用来报告一个输入不是有效的jpeg格式
type FormatError string
func (e FormatError) Error() string
type Reader //不推荐使用Reader
type Reader interface {
io.ByteReader
io.Reader
}
type UnsupportedError
func (e UnsupportedError) Error() string //报告输入使用一个有效但是未实现