androidアプリでアルバムにある画像をトリミングしてjpg形式に変更して、使いたいのですが、エラーが起きてしまいます。
理由がわからないので、もし分かる方がおりましたら、教えて下さい!
エラー内容としましては、"can't compress a recycled bitmap"になります。
よろしくお願いします!
ByteArrayOutputStream bos = new ByteArrayOutputStream();
int w = BitmapImg.getWidth();
int h = BitmapImg.getHeight();
float scale = Math.min((float)800/w, (float)800/h);
Matrix matrix = new Matrix();
matrix.postScale(1, 1);
Bitmap bmp = Bitmap.createBitmap(BitmapImg, 0, 0, w, h, matrix, true);
BitmapImg.recycle();
BitmapImg = null;
//.jpgファイル作成 bmp.compress(Bitmap.CompressFormat.JPEG, 50, bos); <-------ここでエラーが起きる byte[] _bArray = bos.toByteArray();
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2015/12/17 09:49