code: func Decode(r io.Reader, opts *DecodeOpts) (image.Image, Config, error) {
  	var (
  		angle    int
  		buf      bytes.Buffer
  		c        Config
  		flipMode FlipDirection
  	)
  
  	tr := io.TeeReader(io.LimitReader(r, 2<<20), &buf)
  	if opts.useEXIF() {
  		angle, flipMode = exifOrientation(tr)
  	} else {
  		var err error
  		angle, flipMode, err = opts.forcedOrientation()
  		if err != nil {
  			return nil, c, err
  		}
  	}
  
  	// Orientation changing rotations should have their dimensions swapped
  	// when scaling.
  	var swapDimensions bool
  	switch angle {
  	case 90, -90:
  		swapDimensions = true
  	}
  
  	mr := io.MultiReader(&buf, r)
  	im, format, err, rescaled := decode(mr, opts, swapDimensions)
  	if err != nil {
  		return nil, c, err
  	}
  	c.Modified = rescaled
  
  	if angle != 0 {
  		im = rotate(im, angle)
  		c.Modified = true
  	}
  
  	if flipMode != 0 {
  		im = flip(im, flipMode)
  		c.Modified = true
  	}
  
  	c.Format = format
  	c.setBounds(im)
  	return im, c, nil
  }
docs: // Decode decodes an image from r using the provided decoding options.
  // The Config returned is similar to the one from the image package,
  // with the addition of the Modified field which indicates if the
  // image was actually flipped, rotated, or scaled.
  // If opts is nil, the defaults are used.