func Decode(r io.Reader, opt *Options) (m image.Image, err error) {
	data, err := ioutil.ReadAll(r)
	if err != nil {
		return
	}
	hdr, err := rawpDecodeHeader(data)
	if err != nil {
		return
	}

	// new decoder
	decoder, err := rawpPixDecoder(hdr)
	if err != nil {
		return
	}

	// decode snappy
	pix := hdr.Data
	if hdr.UseSnappy != 0 {
		if pix, err = snappy.Decode(nil, hdr.Data); err != nil {
			err = fmt.Errorf("image/rawp: Decode, snappy err: %v", err)
			return
		}
	}

	// decode raw pix
	m, err = decoder.Decode(pix, nil)
	if err != nil {
		return
	}

	// convert color model
	if opt != nil && opt.RawPColorModel != nil {
		m = convert.ColorModel(m, opt.RawPColorModel)
	}

	return
}
// Decode reads a RawP image from r and returns it as an image.Image.
// The type of Image returned depends on the contents of the RawP.
Decode reads a RawP image from r and returns it as an image.Image.
The type of Image returned depends on the contents of the RawP.
// Decode reads a RawP image from r and returns it as an image . Image . // The type of Image returned depends on the contents of the RawP .
func Decode(r io.Reader, opt *Options) (m image.Image, err error) {
	data, err := ioutil.ReadAll(r)
	if err != nil {
		return
	}
	hdr, err := rawpDecodeHeader(data)
	if err != nil {
		return
	}
	decoder, err := rawpPixDecoder(hdr)
	if err != nil {
		return
	}
	pix := hdr.Data
	if hdr.UseSnappy != 0 {
		if pix, err = snappy.Decode(nil, hdr.Data); err != nil {
			err = fmt.Errorf("image/rawp: Decode, snappy err: %v", err)
			return
		}
	}
	m, err = decoder.Decode(pix, nil)
	if err != nil {
		return
	}
	if opt != nil && opt.RawPColorModel != nil {
		m = convert.ColorModel(m, opt.RawPColorModel)
	}
	return
}
func Decode ( r io . Reader , opt * Options ) ( m image . Image , err error ) { data , err := ioutil . ReadAll ( r ) if err != nil { return } hdr , err := rawpDecodeHeader ( data ) if err != nil { return } decoder , err := rawpPixDecoder ( hdr ) if err != nil { return } pix := hdr . Data if hdr . UseSnappy != 0 { if pix , err = snappy . Decode ( nil , hdr . Data ) ; err != nil { err = fmt . Errorf ( " " , err ) return } } m , err = decoder . Decode ( pix , nil ) if err != nil { return } if opt != nil && opt . RawPColorModel != nil { m = convert . ColorModel ( m , opt . RawPColorModel ) } return }
Decode reads a RawP image from r and returns it as an image.Image.
Decode reads a RawP image from r and returns it as an image . Image .
// new decoder // decode snappy // decode raw pix // convert color model