java - Auto Image Rotated from Portrait to Landscape -


i taking photo , storing sd card , , later viewing sd card imageview, getting rotated ...

i capturing in portrait mode , getting resultant image in landscape mode...

is there missing ?

exifutil.java class found here

/**  * displaying captured image/video on screen  * */ private void previewmedia(boolean isimage) {     // checking whether captured media image or video     if (isimage) {         imgpreview.setvisibility(view.visible);          final bitmap bitmap = bitmapfactory.decodefile(filepath);         bitmap orientedbitmap = exifutil.rotatebitmap(filepath, bitmap);          imgpreview.setimagebitmap(orientedbitmap);     } else {         imgpreview.setvisibility(view.gone);     } } 

but still showing rotated image in imageview ...

you need use exif orientation_undefined right orientation.

exifinterface exif = null; try {     exif = new exifinterface(path); } catch (ioexception e) {     e.printstacktrace(); }   int orientation = exif.getattributeint(exifinterface.tag_orientation,                                         exifinterface.orientation_undefined); 

and rotate bitmap :

bitmap bmrotated = rotatebitmap(bitmap, orientation);   

reference link


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -