Reputation: 33956
I'm building a camera app, I'm requesting the camera instance this way and the preview is shown in the right angle:
c = Camera.open();
c.setDisplayOrientation(90);
However after the user takes a photo and loading it into an imageView it's rotated 90 degrees counter clockwise. This is how I save the photo:
@Override
public void onPictureTaken(byte[] data, Camera camera) {
try {
String filePath = folderPath + generateFileName();
FileOutputStream outStream = new FileOutputStream( filePath );
outStream.write(data);
outStream.close();
// Put into imageView
File file = new File(filePath);
if(file.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
last_photo.setImageBitmap(myBitmap);
}
} catch (FileNotFoundException e) {
} catch (IOException e) {
} finally {
}
}
How can I save the image without it being rotated?
Upvotes: 0
Views: 244