List of usage examples for android.media ExifInterface ORIENTATION_ROTATE_90
int ORIENTATION_ROTATE_90
To view the source code for android.media ExifInterface ORIENTATION_ROTATE_90.
Click Source Link
From source file:com.almalence.opencam.PluginManagerBase.java
protected PluginManagerBase() { pluginList = new Hashtable<String, Plugin>(); processingPluginList = new HashMap<Long, Plugin>(); sharedMemory = new Hashtable<String, String>(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) createRAWCaptureResultHashtable(); activeVF = new ArrayList<String>(); // activeFilter = new ArrayList<String>(); listVF = new ArrayList<Plugin>(); listCapture = new ArrayList<Plugin>(); listProcessing = new ArrayList<Plugin>(); // listFilter = new ArrayList<Plugin>(); listExport = new ArrayList<Plugin>(); createPlugins();//from w w w. j av a 2s . c o m // parsing configuration file to setup modes parseConfig(); exifOrientationMap = new HashMap<Integer, Integer>() { { put(0, ExifInterface.ORIENTATION_NORMAL); put(90, ExifInterface.ORIENTATION_ROTATE_90); put(180, ExifInterface.ORIENTATION_ROTATE_180); put(270, ExifInterface.ORIENTATION_ROTATE_270); } }; }
From source file:com.daiv.android.twitter.services.SendTweet.java
public static Bitmap rotateBitmap(Bitmap bitmap, int orientation) { Log.v("Test_composing_image", "rotation: " + orientation); try {/*from w ww. j av a 2 s. com*/ Matrix matrix = new Matrix(); switch (orientation) { case ExifInterface.ORIENTATION_NORMAL: return bitmap; case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: matrix.setScale(-1, 1); break; case ExifInterface.ORIENTATION_ROTATE_180: matrix.setRotate(180); break; case ExifInterface.ORIENTATION_FLIP_VERTICAL: matrix.setRotate(180); matrix.postScale(-1, 1); break; case ExifInterface.ORIENTATION_TRANSPOSE: matrix.setRotate(90); matrix.postScale(-1, 1); break; case ExifInterface.ORIENTATION_ROTATE_90: matrix.setRotate(90); break; case ExifInterface.ORIENTATION_TRANSVERSE: matrix.setRotate(-90); matrix.postScale(-1, 1); break; case ExifInterface.ORIENTATION_ROTATE_270: matrix.setRotate(-90); break; default: return bitmap; } try { Bitmap bmRotated = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); bitmap.recycle(); return bmRotated; } catch (OutOfMemoryError e) { e.printStackTrace(); return null; } } catch (Exception e) { e.printStackTrace(); } return bitmap; }
From source file:com.m2dl.mini_projet.mini_projet_android.MainActivity.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE: if (resultCode == Activity.RESULT_OK) { Uri selectedImage = imageUri; getContentResolver().notifyChange(selectedImage, null); ContentResolver cr = getContentResolver(); try { myBitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImage); myBitmap = BitmapUtil.resize(myBitmap); imageFilePath = imageUri.getPath(); ExifInterface exif = new ExifInterface(imageFilePath); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: myBitmap = BitmapUtil.rotateImage(myBitmap, 90); break; case ExifInterface.ORIENTATION_ROTATE_180: myBitmap = BitmapUtil.rotateImage(myBitmap, 180); break; }/*from ww w. ja va 2s. com*/ String dialogTitle; String dialogMessage; if (!isGPSOn) { dialogTitle = "Golocalisation GPS..."; dialogMessage = "Veuillez activer votre GPS puis patienter pendant la golocalisation"; } else { dialogTitle = "Golocalisation GPS..."; dialogMessage = "Veuillez patienter pendant la golocalisation"; } final ProgressDialog progDialog = ProgressDialog.show(MainActivity.this, dialogTitle, dialogMessage, true); new Thread() { public void run() { try { while (coordLat.equals(0.0d) && coordLong.equals(0.0d)) ; FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); DialogFragment newFragment = PhotoDialogFragment.newInstance(myBitmap, coordLat, coordLong, imageFilePath); newFragment.show(ft, "dialog"); } catch (Exception e) { Log.e(TAG, e.getMessage()); } progDialog.dismiss(); } }.start(); } catch (Exception e) { Toast.makeText(this, "Failed to load", Toast.LENGTH_SHORT).show(); Log.e("Camera", e.toString()); } } } }
From source file:com.google.android.gms.samples.vision.face.photo.PhotoViewerActivity.java
public Bitmap grabImage() { this.getContentResolver().notifyChange(photoURI, null); ContentResolver cr = this.getContentResolver(); Bitmap bitmap;//from www .ja v a2s .c o m try { bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, photoURI); ExifInterface ei = new ExifInterface(mCurrentPhotoPath); int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: bitmap = rotateImage(bitmap, 90); break; case ExifInterface.ORIENTATION_ROTATE_180: bitmap = rotateImage(bitmap, 180); break; case ExifInterface.ORIENTATION_ROTATE_270: bitmap = rotateImage(bitmap, 270); break; case ExifInterface.ORIENTATION_NORMAL: default: break; } return bitmap; } catch (Exception e) { Toast.makeText(this, "Failed to load", Toast.LENGTH_SHORT).show(); Log.d(TAG, "Failed to load", e); return null; } }
From source file:Main.java
/** * get image orientation rotate degree// www. j a v a 2s . c o m * * @param filepath * @return */ public static int getExifOrientation(String filepath) { int degree = 0; ExifInterface exif = null; try { exif = new ExifInterface(filepath); } catch (IOException ex) { Log.d(TAG, "cannot read exif" + ex); } if (exif != null) { int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1); if (orientation != -1) { 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; } } } return degree; }
From source file:com.allen.mediautil.ImageTakerHelper.java
/** * ?//from w w w. jav a 2 s . c o m * * @param path ? * @return degree */ private static int readPictureDegree(String path) { int degree = 0; try { ExifInterface exifInterface = new ExifInterface(path); int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: degree = 90;// SUPPRESS CHECKSTYLE break; case ExifInterface.ORIENTATION_ROTATE_180: degree = 180;// SUPPRESS CHECKSTYLE break; case ExifInterface.ORIENTATION_ROTATE_270: degree = 270;// SUPPRESS CHECKSTYLE break; default: break; } } catch (IOException e) { Log.e("readPictureDegree", "readPictureDegree failed", e); } return degree; }
From source file:com.yanzhenjie.album.task.LocalImageLoader.java
/** * Read the rotation angle of the picture file. * * @param path image path./*from w ww . j a v a 2s . co m*/ * @return one of 0, 90, 180, 270. */ public static int readDegree(String path) { try { 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; default: return 0; } } catch (Exception e) { return 0; } }
From source file:org.planetmono.dcuploader.ActivityUploader.java
public int queryExifOrientation(String path) { int orientation = 0; if (exifConstructor == null) { try {/*w w w . ja v a 2s . c o m*/ exifConstructor = ExifInterface.class.getConstructor(new Class[] { String.class }); exifGetAttributeInt = ExifInterface.class.getMethod("getAttributeInt", new Class[] { String.class, int.class }); } catch (NoSuchMethodException e) { return 0; } } Integer o = 0; try { Object obj = exifConstructor.newInstance(new Object[] { path }); o = (Integer) exifGetAttributeInt.invoke(obj, ExifInterface.TAG_ORIENTATION, new Integer(0)); } catch (Exception e) { return 0; } Log.d(Application.TAG, "orientation " + o); switch (o) { case ExifInterface.ORIENTATION_ROTATE_90: orientation = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: orientation = 180; break; case ExifInterface.ORIENTATION_ROTATE_270: orientation = 270; } return orientation; }
From source file:com.silentcircle.common.util.ViewUtil.java
/** * Finds JPEG image rotation flags from exif and returns matrix to be used to rotate image. * * @param fileName JPEG image file name. * * @return Matrix to use in image rotate transformation or null if parsing failed. *///from www .j a v a 2 s .c om public static Matrix getRotationMatrixFromExif(final String fileName) { Matrix matrix = null; try { ExifInterface exif = new ExifInterface(fileName); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); int rotate = 0; switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: rotate = ROTATE_90; break; case ExifInterface.ORIENTATION_ROTATE_180: rotate = ROTATE_180; break; case ExifInterface.ORIENTATION_ROTATE_270: rotate = ROTATE_270; break; } if (rotate != 0) { matrix = new Matrix(); matrix.preRotate(rotate); } } catch (IOException e) { Log.i(TAG, "Failed to determine image flags from file " + fileName); } return matrix; }
From source file:com.almalence.opencam.PluginManager.java
@Override protected void createPlugins() { pluginList = new Hashtable<String, Plugin>(); processingPluginList = new HashMap<Long, Plugin>(); sharedMemory = new Hashtable<String, String>(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) createRAWCaptureResultHashtable(); activeVF = new ArrayList<String>(); // activeFilter = new ArrayList<String>(); listVF = new ArrayList<Plugin>(); listCapture = new ArrayList<Plugin>(); listProcessing = new ArrayList<Plugin>(); // listFilter = new ArrayList<Plugin>(); listExport = new ArrayList<Plugin>(); // init plugins and add to pluginList /*//w ww. j a v a 2 s .c om * Insert any new plugin below (create and add to list of concrete type) */ // VF AeAwLockVFPlugin aeawlockVFPlugin = new AeAwLockVFPlugin(); pluginList.put(aeawlockVFPlugin.getID(), aeawlockVFPlugin); listVF.add(aeawlockVFPlugin); HistogramVFPlugin histgramVFPlugin = new HistogramVFPlugin(); pluginList.put(histgramVFPlugin.getID(), histgramVFPlugin); listVF.add(histgramVFPlugin); BarcodeScannerVFPlugin barcodeScannerVFPlugin = new BarcodeScannerVFPlugin(); pluginList.put(barcodeScannerVFPlugin.getID(), barcodeScannerVFPlugin); listVF.add(barcodeScannerVFPlugin); GyroVFPlugin gyroVFPlugin = new GyroVFPlugin(); pluginList.put(gyroVFPlugin.getID(), gyroVFPlugin); listVF.add(gyroVFPlugin); ZoomVFPlugin zoomVFPlugin = new ZoomVFPlugin(); pluginList.put(zoomVFPlugin.getID(), zoomVFPlugin); listVF.add(zoomVFPlugin); GridVFPlugin gridVFPlugin = new GridVFPlugin(); pluginList.put(gridVFPlugin.getID(), gridVFPlugin); listVF.add(gridVFPlugin); FocusVFPlugin focusVFPlugin = new FocusVFPlugin(); pluginList.put(focusVFPlugin.getID(), focusVFPlugin); listVF.add(focusVFPlugin); InfosetVFPlugin infosetVFPlugin = new InfosetVFPlugin(); pluginList.put(infosetVFPlugin.getID(), infosetVFPlugin); listVF.add(infosetVFPlugin); // Capture CapturePlugin testCapturePlugin = new CapturePlugin(); pluginList.put(testCapturePlugin.getID(), testCapturePlugin); listCapture.add(testCapturePlugin); ExpoBracketingCapturePlugin expoBracketingCapturePlugin = new ExpoBracketingCapturePlugin(); pluginList.put(expoBracketingCapturePlugin.getID(), expoBracketingCapturePlugin); listCapture.add(expoBracketingCapturePlugin); NightCapturePlugin nightCapturePlugin = new NightCapturePlugin(); pluginList.put(nightCapturePlugin.getID(), nightCapturePlugin); listCapture.add(nightCapturePlugin); BurstCapturePlugin burstCapturePlugin = new BurstCapturePlugin(); pluginList.put(burstCapturePlugin.getID(), burstCapturePlugin); listCapture.add(burstCapturePlugin); BestShotCapturePlugin bestShotCapturePlugin = new BestShotCapturePlugin(); pluginList.put(bestShotCapturePlugin.getID(), bestShotCapturePlugin); listCapture.add(bestShotCapturePlugin); MultiShotCapturePlugin multiShotCapturePlugin = new MultiShotCapturePlugin(); pluginList.put(multiShotCapturePlugin.getID(), multiShotCapturePlugin); listCapture.add(multiShotCapturePlugin); VideoCapturePlugin videoCapturePlugin = new VideoCapturePlugin(); pluginList.put(videoCapturePlugin.getID(), videoCapturePlugin); listCapture.add(videoCapturePlugin); PreshotCapturePlugin backInTimeCapturePlugin = new PreshotCapturePlugin(); pluginList.put(backInTimeCapturePlugin.getID(), backInTimeCapturePlugin); listCapture.add(backInTimeCapturePlugin); PanoramaAugmentedCapturePlugin panoramaAugmentedCapturePlugin = new PanoramaAugmentedCapturePlugin(); pluginList.put(panoramaAugmentedCapturePlugin.getID(), panoramaAugmentedCapturePlugin); listCapture.add(panoramaAugmentedCapturePlugin); PreshotProcessingPlugin backInTimeProcessingPlugin = new PreshotProcessingPlugin(); pluginList.put(backInTimeProcessingPlugin.getID(), backInTimeProcessingPlugin); listCapture.add(backInTimeProcessingPlugin); // Processing SimpleProcessingPlugin simpleProcessingPlugin = new SimpleProcessingPlugin(); pluginList.put(simpleProcessingPlugin.getID(), simpleProcessingPlugin); listProcessing.add(simpleProcessingPlugin); NightProcessingPlugin nightProcessingPlugin = new NightProcessingPlugin(); pluginList.put(nightProcessingPlugin.getID(), nightProcessingPlugin); listProcessing.add(nightProcessingPlugin); HDRProcessingPlugin hdrProcessingPlugin = new HDRProcessingPlugin(); pluginList.put(hdrProcessingPlugin.getID(), hdrProcessingPlugin); listProcessing.add(hdrProcessingPlugin); MultiShotProcessingPlugin multiShotProcessingPlugin = new MultiShotProcessingPlugin(); pluginList.put(multiShotProcessingPlugin.getID(), multiShotProcessingPlugin); listProcessing.add(multiShotProcessingPlugin); PanoramaProcessingPlugin panoramaProcessingPlugin = new PanoramaProcessingPlugin(); pluginList.put(panoramaProcessingPlugin.getID(), panoramaProcessingPlugin); listProcessing.add(panoramaProcessingPlugin); BestshotProcessingPlugin bestshotProcessingPlugin = new BestshotProcessingPlugin(); pluginList.put(bestshotProcessingPlugin.getID(), bestshotProcessingPlugin); listProcessing.add(bestshotProcessingPlugin); // Filter // Export ExportPlugin testExportPlugin = new ExportPlugin(); pluginList.put(testExportPlugin.getID(), testExportPlugin); listExport.add(testExportPlugin); // parsing configuration file to setup modes parseConfig(); exifOrientationMap = new HashMap<Integer, Integer>() { { put(0, ExifInterface.ORIENTATION_NORMAL); put(90, ExifInterface.ORIENTATION_ROTATE_90); put(180, ExifInterface.ORIENTATION_ROTATE_180); put(270, ExifInterface.ORIENTATION_ROTATE_270); } }; }