如何从Android中的图像文件的元数据 [英] How to retrieve metadata from image file in Android

查看:165
本文介绍了如何从Android中的图像文件的元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能检索元数据信息,如Android的环境格式(JPEG,BMP,PNG,...),宽度,高度等,从图像文件?

How can I retrieve metadata information such as format (jpeg, bmp, png, ..), width, height etc. from image files in Android environment?

推荐答案

您可以提取宽度,高度和这样图像的MIME类型:

You can extract the width, height, and MIME type of an image like this:

    BitmapFactory.Options opts=new BitmapFactory.Options();
    opts.inJustDecodeBounds=true;
    BitmapFactory.decodeFile("/sdcard/path/to/imagefile.blah", opts);
    Log.i(TAG, "Mimetype:" + opts.outMimeType);
    Log.i(TAG, "Width:" + opts.outWidth);
    Log.i(TAG, "Height:" + opts.outHeight);

这篇关于如何从Android中的图像文件的元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆