PeachImage

PeachImage.Image

Image.ApplyOrientationInPlace(ImageOrientation) Method

Applies orientation to this image’s own pixels without allocating. Only possible when the result has the same dimensions: always for Normal, MirrorHorizontal, Rotate180 and MirrorVertical, and for the other four only on a square image.

public void ApplyOrientationInPlace(PeachImage.ImageOrientation orientation);

Parameters

orientation ImageOrientation

Exceptions

System.ArgumentOutOfRangeException
orientation is not a defined orientation.

System.InvalidOperationException
The orientation swaps width and height and this image is not square: use ApplyOrientation(ImageOrientation) or ApplyOrientation(ImageOrientation, Image).

Remarks

The resolution of a square image is not changed. An EXIF profile in Metadata is replaced by a copy whose orientation tag is reset to 1 (the original profile’s bytes are never mutated), so saving the image with its metadata does not turn the already-upright pixels a second time. Orientation recorded elsewhere, such as in XMP, is not rewritten.