Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.media.ExifInterface;

import java.io.File;

import java.io.IOException;

public class Main {
    /**
     * Get Image Orientation from file
     *
     * @param imageFile File for which orientation is changed
     * @return Current Orientation
     */
    public static int getBitmapOrientation(File imageFile) {
        try {
            ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath());
            return exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1);
        } catch (IOException e) {
        }
        return 0;
    }
}