如何在 Android 环境中从图像文件中检索格式(jpeg、bmp、png、..)、宽度、高度等元数据信息?
最佳答案
您可以像这样提取图像的宽度、高度和 MIME 类型:
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 - 如何从 Android 中的图像文件中检索元数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4928660/