Help Why some pictures taken when viewed in Gallery appears rotated with black bars top and bottom?


Android Enthusiast
I took the picture using camera with the camera in upright (portrait)(holding the phone upright)
(holding the phone upright). This is how it looks when I am taking the picture

After taking the picture, in Gallery, when I view the picture (holding the phone upright), the picure appears in landscape mode with black bars. It looks like this

So I need to rotate the image to make it look exactly same like when I was taking the picture.

My screen rotation is always turned on. By default the phone has screen rotation turned on since first day.

However not all pictures taken have black bars and need to rotate. The black bar pictures happen sometimes, but some pictures do not have black bars and they are exactly as what I see during when I take the pictures, For example I took in portrait, when i view it is appear as portrait without black bars.

Is there something wrong with my phone?