开发者

How to retrieve metadata from image file in Android

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


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);


Yes, try looking up the ContentValues class, contentResolver() function, and the URI class. This should have the information you need do whatever you're trying to do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜