1
カメラ画像を回転しようとしています。コードは以下のようになります。android:画像処理のメモリ管理を改善する方法
Bitmap result = Bitmap.createBitmap(bitmap.getHeight(), bitmap.getWidth(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(result);
canvas.save();
canvas.rotate(90);
canvas.translate(0, -1*bitmap.getHeight());
canvas.drawBitmap(bitmap, new Matrix(), null);
canvas.restore();
String path = String.format(dir+"pic_%d.jpg", System.currentTimeMillis());
stream = new FileOutputStream(path);
bitmap.compress(CompressFormat.JPEG, this.imageQuality, stream);
stream.flush();
stream.close();
問題がある:私はOutOfMemoryExceptionが(最初の行)を取得しています。余分なスレッドや他の解決策でこれを実現する方法はありますか?現在、画像を縮小することは選択肢ではありません。