android - How set Orientation Hint of file Image? -


This image is captured by standard camera and opened by the gallery of Android

 Enter image details here

This image capture by my app camera and opens by the gallery of Android Enter image details here

How to set the orientation of image image (it displays the same standard camera Can)

I try with the camera's saturation, but it does not work:

  Camera. Parameter parameter = mCamera.getParameters (); Parameters.setRotation (rotation); mCamera.setParameters (parameter);   

If I use recorded video: MediaRecorder.setOrientationHint (rotation); But the image I do not know can you help me?

You need to implement your own photo capture activity to get the desired orientation for each Capture image on every device.

I have implemented a capture activity, so you can take photos and set the orientation of photos. You can see my answer about the rotation of images on this topic:

Implementation:

Save the picture function for the answer given above :

Save Photo Function:

  Public Zero Saved Photos (Bitmap BMP) {imageFileFolder = New File (Environmental.getExternalStorageDirectory (), cc.getDirectoryName ()); ImageFileFolder.mkdir (); FileOutputStream Out = Null; Calendar c = Calendar.getInstance (); String date = IIT (Cd. MONTH) + IITT (C.GATE (calendar DAY_OF_MONTH)) + IITT (C.Gate (calendar.IEER)) + IITT (C Gate (HORRUYY)) + From IITT (CAGAT (CalendarMINUEE) + IITT (CGAT (Calendar. SCND)); ImageFileName = new file (imageFileFolder, date.toString () + ".jpg"); {Out} Try new FileOutputStream (imageFileName); Bmp.compress (bitmap.compress format.jpg, 70, out); Out.flush (); Out.close (); scanPhoto (imageFileName.toString ()); Out = null; } Hold (exception e) {e.printStackTrace (); }}   

ScanFoto Function:

  Public Zero ScanFoto (Last String ImageFilename) {geniusPath = imageFileName; MsConn = New MediaConnection Connection (MyClass.this, New MediaConnection Connection component) {Media Connected on Public Zero () {msConn.scanFile (imageFileName, null);} @ Override Scanning on Zero (String Path, Uri Uri) {msConn. Disconnect ();}}); MsConn.connect (); }   

SavePhotoTask class:

  class SavePhotoTask asyncTask and lt; Byte [], string, string & gt; {@Override protected string doInBackground (byte [...] JPEG) Photo of file = new file (Environment Tag ExportStyle Directory ("," photo.jpg "); If (photo.exists ()) {photo.delete (); } {FileOutputStream fos = new FileOutputStream (try photo.getPath ()); Fos.write (jpeg [0]); Fos.close (); } Hold (java.io.IOException e) {} return (empty); }}    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -