问题描述
我需要知道的图像从画廊(相机拍摄)的方向。我最初的方法是使用MediaStore.Images.Media.ORIENTATION这是工作为我的Droid 1.在测试的HTC霹雳的手机只保存0到该字段。
我然后转移到读取EXIF数据:
ExifInterface exifReader =新ExifInterface(mFilePath);
exifReader.getAttributeInt(ExifInterface.TAG_ORIENTATION,-1);
这也将返回0,每一个形象。任何人对如何正确获取照片的方向采取在Android的想法?
我的解决办法:
删除任何检查从EXIF数据的方向。我无法找到一个实例,它是准确的。
使用标准的的String [] orientationColumn = {MediaStore.Images.Media.ORIENTATION};
来得到一个方向
如果这是 0
使用德codeStream ...
否则为景观
I need to know the orientation of an image from the gallery (taken by the camera). My initial approach was to use MediaStore.Images.Media.ORIENTATION which was working for my Droid 1. While testing on the HTC Thunderbolt that phone only saves 0 to that field.
I then moved to reading the exif data:
ExifInterface exifReader = new ExifInterface(mFilePath);
exifReader.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1);
This also returns 0 for every image. Anyone have ideas on how to properly get the orientation of a photo take on android?
My solution:
Remove any checking for orientation from exif data. I could not find one instance where it was accurate.
Use the standard String[] orientationColumn = {MediaStore.Images.Media.ORIENTATION};
to get an orientation.
If this is 0
usedecodeStream...
else it is landscape
这篇关于Exif数据中TAG_ORIENTATION始终为0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!