List of usage examples for android.media ExifInterface ExifInterface
public ExifInterface(InputStream inputStream) throws IOException
From source file:Main.java
private static int getExifOrientation(String src) throws Exception { ExifInterface exifInterface = new ExifInterface(src); return exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); }
From source file:Main.java
public static ExifInterface getExif(final String s) { try {/*w w w.j a va2s . co m*/ return new ExifInterface(s); } catch (IOException ex) { ex.printStackTrace(); return null; } }
From source file:Main.java
public static boolean hasGpsTag(String file) { try {/*ww w. j a v a 2s. c o m*/ ExifInterface exifInterface = new ExifInterface(file); // north and south if (exifInterface.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF) == null) return false; } catch (IOException e) { // TODO Auto-generated catch block return false; } return true; }
From source file:Main.java
public static boolean hasGPSInfo(String path) { try {// w w w . ja v a 2 s.com ExifInterface exf = new ExifInterface(path); float[] latlnt = new float[2]; exf.getLatLong(latlnt); if (latlnt[0] <= 0 || latlnt[1] <= 0) { return false; } } catch (Exception e) { e.printStackTrace(); return false; } return true; }
From source file:Main.java
public static int readPictureDegree(String path) { int degree = 0; try {// w ww . j a va2s .co m ExifInterface exifInterface = new ExifInterface(path); int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: degree = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: degree = 180; break; case ExifInterface.ORIENTATION_ROTATE_270: degree = 270; break; } } catch (Exception e) { e.printStackTrace(); } return degree; }
From source file:Main.java
public static ExifInterface getExifInterface(String imageFilePath) throws IOException { return new ExifInterface(imageFilePath); }
From source file:Main.java
public static int getImageOrientation(String uri) throws IOException { ExifInterface exif = new ExifInterface(uri); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); return orientation; }
From source file:Main.java
public static int getOrientationFromExif(String imagePath) { int orientation = 0; try {/*from ww w . ja v a 2 s . c o m*/ ExifInterface exif = new ExifInterface(imagePath); int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (exifOrientation) { case ExifInterface.ORIENTATION_ROTATE_270: orientation = 270; break; case ExifInterface.ORIENTATION_ROTATE_180: orientation = 180; break; case ExifInterface.ORIENTATION_ROTATE_90: orientation = 90; break; case ExifInterface.ORIENTATION_NORMAL: orientation = 0; break; default: break; } } catch (Exception e) { } return orientation; }
From source file:Main.java
public static int getOrientationFromExif(String localPath) { ExifInterface exif = null;//from www. jav a2s .c o m int orientation = 0; try { exif = new ExifInterface(localPath); orientation = exif.getAttributeInt("Orientation", 0); } catch (IOException ex) { } return orientation; }
From source file:Main.java
public static int getFileExifDegree(String path) { try {//w ww. j a v a2 s. c o m ExifInterface exifInterface = new ExifInterface(path); int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: return 90; case ExifInterface.ORIENTATION_ROTATE_180: return 180; case ExifInterface.ORIENTATION_ROTATE_270: return 270; } } catch (IOException e) { e.printStackTrace(); } return 0; }