JPG wroteIt only takes one byte to define orientation of the 'camera' when a pix is taken. WHY hide that byte in 'meta data' which is not relevant to displaying the pix. Yes it would still require the displaying software to 'look' at that byte, but it is more easily located IF it is the first byte in the photo 'stream'.
Full disclosure: I consider 'meta data to be unnecessary extra baggage which can exceed the byte count of the item it 'describes'.
I know a small voice the the wilderness! :D
P. S. This in never a problem IF one passes the pix file through a photo editor(like Irfanview) which always displays correctly(since I assume it looks at that orientation thingie) and saves it in correct orientation for subsequent passing to other stuff.(as a jpeg file). But I digress!!!!
I may have misspoke as to where the flag is stored, :)
The photo editor I normally use, (Shotwell Photo Manager), doesn't correct the orientation when I export (save) the file, neither have I been successful with a few other programs I tried in the past, and sometimes got weird results, once I finally got one to rotate properly but the width/height pixel info was out of sync so it was distorted.
Recently I was succeeded using GIMP, but it took two or three tries, and efforts in the past had failed. There was an option that had to be selected to get the desired result, but that wasn't the default.
Anyway, the simplest way is still, just take the photo in landscape, then it is only file size that needs fixing. ;)