Table of Contents

Enum JpegTransformOperation

Namespace
Egami.Formats.Jpeg
Assembly
Egami.dll

The rotation or flip a lossless JPEG transform applies, in the terms of jpegtran.

public enum JpegTransformOperation

Fields

AutoOrient = 8

Whatever the EXIF orientation needs to show the image upright, after which the orientation is set to Normal: the lossless version of AutoOrient(). A file with no orientation, or an upright one, is copied.

FlipHorizontal = 1

Mirrored left to right.

FlipVertical = 2

Mirrored top to bottom.

None = 0

No rotation or flip; with Crop or Grayscale only those apply.

Rotate180 = 4

Turned 180°.

Rotate270 = 5

Turned 270° clockwise (90° counterclockwise).

Rotate90 = 3

Turned 90° clockwise.

Transpose = 6

Mirrored along the top-left to bottom-right diagonal: rows become columns.

Transverse = 7

Mirrored along the top-right to bottom-left diagonal.

Examples

// Turns the photo upright by its EXIF orientation without re-encoding: no quality is lost, and the tag is reset.
JpegTransform.Apply("sideways.jpg", "upright.jpg", new JpegTransformOptions { Operation = JpegTransformOperation.AutoOrient });

// Rotates, crops and drops the color in one pass; a file can be transformed in place.
JpegTransformResult result = JpegTransform.Apply("upright.jpg", "upright.jpg", new JpegTransformOptions
{
    Operation = JpegTransformOperation.Rotate90,
    Crop = new Rect(0, 0, 200, 120),
    Grayscale = true,
});
Console.WriteLine($"{result.Width} × {result.Height}");