Incorrect image orientation

I take pictures on the device using:

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    cameraIntent.putExtra("crop", "true");
    cameraIntent.putExtra("aspectX", 0);
    cameraIntent.putExtra("aspectY", 0);
    cameraIntent.putExtra("outputX", 150);
    cameraIntent.putExtra("outputY", 200);
    startActivityForResult(cameraIntent, CAMERA_REQUEST);

I also take pictures from the gallery, and both photos taken immediately using the code above and old images taken with the device from the gallery are stored in Firebase in the wrong orientation. They are displayed on the device in order, and if you go to the download link, that's fine.

Previewing in the Firebase repository and when loading the image using Picasso causes this problem. I'm not quite sure, but Glide did not have this problem, I believe. But I can not use Glide due to problems with the flickering Recyclerview.

Some images are just subtle orientations wise, many of them are not taken from the device ...

How can I get the correct orientation for images?

+4

Source: https://habr.com/ru/post/1666899/


All Articles