i have application uses camera api, not camera2, , works great. here doing (1) capture photo camera api using takepicture(null, null, mpicturecallback) method. (2) byte[] data array converted bitmap , put on screen in callback
i have set picture size , preview size in camera parameters. hoping have similar snapchat. take photo , scales every screen without distortion or cropping. how possible?
possibly rotating matrix of image before save it. thats why image it´s streched, don´t rotate matrix , save correct value of orientation in exifinterface. try use image:
exifinterface exif=new exifinterface(picturefile.tostring()); log.d("exif value", exif.getattribute(exifinterface.tag_orientation)); if(exif.getattribute(exifinterface.tag_orientation).equalsignorecase("6")){ realimage= rotate(realimage, 90); } else if(exif.getattribute(exifinterface.tag_orientation).equalsignorecase("8")){ realimage= rotate(realimage, 270); } else if(exif.getattribute(exifinterface.tag_orientation).equalsignorecase("3")){ realimage= rotate(realimage, 180); } else if(exif.getattribute(exifinterface.tag_orientation).equalsignorecase("0")){ realimage= rotate(realimage, 45); }
other way it´s byte array it´s saved wrong orientation, in case must go code , check parameter using when create contentbuilder, check mediaservice parameter:`
mediastore.images.imagecolumns.orientation
finally had similar problem not saved image, camera preview, problem appear when didnt reset camera session, buffer have different size. check post, maybe solution or code resize image.
camera previewview streched in android devices
good luck!
Comments
Post a Comment