package net.coobird.thumbnailator.util.exif; /** * Representation for the Orientation (Tag 274) in the Exif metadata, as * defined in Section 4.6.4 of the Exif Specification version 2.3. * * @author coobird * */ public enum Orientation { /** * Orientation 1. * */ TOP_LEFT(1), /** * Orientation 2. * */ TOP_RIGHT(2), /** * Orientation 3. * */ BOTTOM_RIGHT(3), /** * Orientation 4. * */ BOTTOM_LEFT(4), /** * Orientation 5. * */ LEFT_TOP(5), /** * Orientation 6. * */ RIGHT_TOP(6), /** * Orientation 7. * */ RIGHT_BOTTOM(7), /** * Orientation 8. * */ LEFT_BOTTOM(8), ; private int value; private Orientation(int value) { this.value = value; } /** * Returns the {@link Orientation} corresponding to the given orientation * value. * * @param value The orientation value. * @return {@link Orientation} corresponding to the orientation * value. Return {@code null} if the given value does not * correspond to a valid {@link Orientation}. */ public static Orientation typeOf(int value) { for (Orientation orientation : Orientation.values()) { if (orientation.value == value) { return orientation; } } return null; } /** * Returns a textual {@link String} reprensentation of this enum. * @return A textual representation of this enum. */ @Override public String toString() { return "Orientation [type=" + value + "]"; } }