title: Android Camera2 pictures appear rotated in gallery
body: <p>I have made an app which takes pictures (portrait, landscape or selfie) using the <a href="https://github.com/googlesamples/android-Camera2Basic" rel="nofollow noreferrer">Google Camera2 sample</a>. Everything works, I can take the pictures, they are saved, etc. </p>
  
  <p>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 <strong>read</strong> images in the correct orientation, but what about saving them properly? </p>
  
  <p>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?</p>