簡體   English   中英

在Decodefile之前如何獲取android中圖像的高度和寬度?

[英]Before Decodefile how to get height and width of the image in android?

如何根據設備設置isSamplesize? 例如,對於5MP,8MP,13Mp攝像機,圖像大小會有所不同。 如何處理呢?

使用BitmapFactory.Options.inJustDecodeBoundsAndroid 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM