Gibt es eine Möglichkeit, Byte-Array zu drehen, ohne es in Bitmap zu decodieren?Byte-Array von JPEG nach onPictureTaken drehen
Derzeit in jpeg PictureCallback schreibe ich nur Byte-Array direkt in Datei. Aber Bilder werden gedreht. Ich möchte sie drehen, ohne zu entschlüsseln, um Bitmap mit der Hoffnung zu machen, dass dies mein Gedächtnis konserviert.
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(data, 0, data.length, o);
int orientation;
if (o.outHeight < o.outWidth) {
orientation = 90;
} else {
orientation = 0;
}
File photo = new File(tmp, "demo.jpeg");
FileOutputStream fos;
BufferedOutputStream bos = null;
try {
fos = new FileOutputStream(photo);
bos = new BufferedOutputStream(fos);
bos.write(data);
bos.flush();
} catch (IOException e) {
Log.e(TAG, "Failed to save photo", e);
} finally {
IOUtils.closeQuietly(bos);
}
Hallo. Hast du das geschafft? Danke, Mann. – Paul
Leider nicht. –
@Paul: siehe http://StackOverflow.com/a/16655188/192373 –