[英]Before Decodefile how to get height and width of the image in android?
如何根據設備設置isSamplesize? 例如,對於5MP,8MP,13Mp攝像機,圖像大小會有所不同。 如何處理呢?
使用BitmapFactory.Options.inJustDecodeBounds
( Android docs ):
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, options);
// now width and height are in options.outWidth and options.outHeight
由此,您可以計算inSampleSize
, 這是一個示例 (尚未測試)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.