2014-04-23 59 views
0

要調整在Android的位圖的危險,我想這樣做什麼是設置outWidth和outHeight而不是inSampleSize解碼位

BitmapFactory.Options options = new BitmapFactory.Options(); 
options.inSampleSize = 1; 
options.inJustDecodeBounds = true; 
BitmapFactory.decodeFile(filepath, options); 
// options.inSampleSize = ImageResizer.calculateInSampleSize(options, x, y); 
options.outWidth = x; 
options.outHeight = y; 
options.inJustDecodeBounds = false; 
Bitmap bmp = BitmapFactory.decodeFile(filepath, options); 

請,通知該行註釋掉的。如何將我的做法有不同(比較和對比)更常見的

BitmapFactory.Options options = new BitmapFactory.Options(); 
options.inSampleSize = 1; 
options.inJustDecodeBounds = true; 
BitmapFactory.decodeFile(filepath, options); 
options.inSampleSize = ImageResizer.calculateInSampleSize(options, x, y); 
// options.outWidth = x; 
// options.outHeight = y; 
options.inJustDecodeBounds = false; 
Bitmap bmp = BitmapFactory.decodeFile(filepath, options); 

怎麼樣,如果我把所有的人?如在

BitmapFactory.Options options = new BitmapFactory.Options(); 
options.inSampleSize = 1; 
options.inJustDecodeBounds = true; 
BitmapFactory.decodeFile(filepath, options); 
options.inSampleSize = ImageResizer.calculateInSampleSize(options, x, y); 
options.outWidth = x; 
options.outHeight = y; 
options.inJustDecodeBounds = false; 
Bitmap bmp = BitmapFactory.decodeFile(filepath, options); 

回答

0

哪些設置outWidth和outHeight代替inSampleSize用於解碼位圖的危險

outWidthoutHeight是輸出值。它們不是輸入值。自己設置它們不會有用。

相關問題