MLTSHP / mltshp

Source for the application that runs mltshp.com
https://mltshp.com/
Mozilla Public License 2.0
50 stars 21 forks source link

Portrait posts from iOS are incorrectly rotated #52

Open patrickt opened 7 years ago

patrickt commented 7 years ago

When posting directly from a new portrait mode photo on iOS, the image is posted to Mltshp as rotated 90 deg. This is a carryover issue from Mlkshk. There's an effective workaround to edit (crop, levels, any change) within the iOS Photos app then repost, but it would be much nicer if Mltshp could detect the proper orientation with the default image.

jessamynwest commented 4 years ago

I'd like us to either detect this or add a rotate option within MLTSHP

jessamynwest commented 4 years ago

I have now seen a thing this week where the IMAGE will show up fine but the thumbnails are sideways.

bezthomas commented 3 years ago

Copying over testing info from the Slack. This was prompted by @jessamynwest reporting seeing her image right side up, but everyone else seeing it sideways.

Behavior is identical for uploading via Chrome - the uploaded image is temporarily cached, including Exif tags, causing it to be correctly oriented. On reload, image is sideways.

I suspect what's happening is that the Exif Orientation tags are being stripped or ignored. This comment suggests that Orientation data is preserved on upload even in Mobile Safari, and desktop should be fine, so it's probably happening server side?

bezthomas commented 3 years ago

Tested on both Chrome and Firefox, MacOS, I see different behavior between the docker build and the live site.

Uploaded to docker instance, Exif tags survive the round trip of upload/download: orientation is preserved. Uploaded via FF to live instance, Exif tags disappear after upload/download, so orientation breaks on reload.

dphiffer commented 3 years ago

I have solved the EXIF orientation tag puzzle before and my advice is to strip out the tag as early as possible in the upload process. The way I've dealt with it before is with a utility called jhead:

jhead -autorot [file]

But the HEIC conversion process does make it a little more tricky. Stripping out the EXIF orientation tag must also be combined with resorting the pixels (which is what jhead does) otherwise you end up with sideways images. So if there's some way to leave the tags intact through the conversion to JPEG, that method could possibly work here.

bezthomas commented 3 years ago

I think mltshp currently doesn't handle HEIC or a bunch of other formats at all. #562