Android Camera2 pictures appear rotated in gallery

Viewed 2252

I have made an app which takes pictures (portrait, landscape or selfie) using the Google Camera2 sample. Everything works, I can take the pictures, they are saved, etc.

But when I open my phone's (Samsung S7) gallery then all the selfies and portrait pictures are rotated 90 degrees. The landscape pictures are fine though. I have seen a lot of post about how to read images in the correct orientation, but what about saving them properly?

I have my own gallery in my app and there the pictures are loaded correctly (using Glide) without any special rotation fixing, so I am not sure what I did wrong and most importantly, how do I fix this?

2 Answers
Related