code: func Decode(r io.Reader, opts ...DecodeOption) (image.Image, error) {
  	cfg := defaultDecodeConfig
  	for _, option := range opts {
  		option(&cfg)
  	}
  
  	if !cfg.autoOrientation {
  		img, _, err := image.Decode(r)
  		return img, err
  	}
  
  	var orient orientation
  	pr, pw := io.Pipe()
  	r = io.TeeReader(r, pw)
  	done := make(chan struct{})
  	go func() {
  		defer close(done)
  		orient = readOrientation(pr)
  		io.Copy(ioutil.Discard, pr)
  	}()
  
  	img, _, err := image.Decode(r)
  	pw.Close()
  	<-done
  	if err != nil {
  		return nil, err
  	}
  
  	return fixOrientation(img, orient), nil
  }
docs: // Decode reads an image from r.