コード例 #1
0
ファイル: orientation.go プロジェクト: kitwalker12/fotomat
// Apply executes a set of operations to change the pixel ordering from
// orientation to TopLeft.
func (orientation Orientation) Apply(image *vips.Image) error {
	oi := &orientationInfo[orientation]

	if oi.apply == nil {
		return nil
	}

	// We want to stay sequential, so we copy memory here and execute
	// all work in the pipeline so far.
	if err := image.Write(); err != nil {
		return err
	}

	if err := oi.apply(image); err != nil {
		return err
	}

	_ = image.ImageRemove(vips.ExifOrientation)

	return nil
}