从android中的图像获取元数据
我正在尝试使用ExiFinInterface获取jpg图像的元数据。 我能够获得数据,但我对flash数据感到困惑。 我如何从元数据中知道flash处于打开/关闭状态? 这是我的密码从android中的图像获取元数据,android,image,metadata,Android,Image,Metadata,我正在尝试使用ExiFinInterface获取jpg图像的元数据。 我能够获得数据,但我对flash数据感到困惑。 我如何从元数据中知道flash处于打开/关闭状态? 这是我的密码 public class MainActivity extends Activity { TextView myTextView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle sa
public class MainActivity extends Activity {
TextView myTextView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myTextView = (TextView) findViewById(R.id.textview);
// change with the filename & location of your photo file
String filename = "/sdcard/DCIM/Camera/b.jpg";
try {
ExifInterface exif = new ExifInterface(filename);
ShowExif(exif);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Toast.makeText(this, "Error!", Toast.LENGTH_LONG).show();
}
}
private void ShowExif(ExifInterface exif) {
String myAttribute = "Exif information ---\n";
myAttribute += getTagString(ExifInterface.TAG_DATETIME, exif);
myAttribute += getTagString(ExifInterface.TAG_FLASH, exif);
myAttribute += getTagString(ExifInterface.TAG_GPS_LATITUDE, exif);
myAttribute += getTagString(ExifInterface.TAG_GPS_LATITUDE_REF, exif);
myAttribute += getTagString(ExifInterface.TAG_GPS_LONGITUDE, exif);
myAttribute += getTagString(ExifInterface.TAG_GPS_LONGITUDE_REF, exif);
myAttribute += getTagString(ExifInterface.TAG_IMAGE_LENGTH, exif);
myAttribute += getTagString(ExifInterface.TAG_IMAGE_WIDTH, exif);
myAttribute += getTagString(ExifInterface.TAG_MAKE, exif);
myAttribute += getTagString(ExifInterface.TAG_MODEL, exif);
myAttribute += getTagString(ExifInterface.TAG_ORIENTATION, exif);
myAttribute += getTagString(ExifInterface.TAG_WHITE_BALANCE, exif);
myTextView.setText(myAttribute);
}
private String getTagString(String tag, ExifInterface exif) {
return (tag + " : " + exif.getAttribute(tag) + "\n");
}
}
谢谢flash tag的值是多少?我会根据不同的设备得到不同的值,比如HTC one ON:9、OFF:16、auto:24,其中nexus 4中的任何flash的开启或关闭都是空的。