ありがとうございます。実は自前でここに記入したあと解決したのですが、やりかたは教えていただいた形でやりました。
コピペで他人が使えるようにメソッド残しておきます。
こんな感じで
private Bitmap getBitmapFromUri(Uri imageUri) {
// 読み込み計算用ローカル変数
int gaso = 0;
int urningGaso = 4000000;
float scale = 1f;
Bitmap resizeBMP = null;
ContentResolver cr = getContentResolver();
String[] columns = { MediaStore.Images.Media.DATA };
Cursor c = cr.query(imageUri, columns, null, null, null);
// pathを取得
c.moveToFirst();
String src = c.getString(0);
// 読み込み用のオプションオブジェクトを生成
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(src, options);
int scaleW = options.outWidth;
int scaleH = options.outHeight;
if ((gaso = scaleW * scaleH) > urningGaso) {
scale = (float) gaso / (float) urningGaso + 1f;
}
options.inJustDecodeBounds = false;
options.inSampleSize = (int) scale;
resizeBMP = BitmapFactory.decodeFile(src, options);
if (scale > 1f) {
toastAlert("画像が大きいので縮小されました。", 4);
}
return resizeBMP;
> E-Mail:
taros...@gmail.com