Attachment images rotated incorrectly

(Andrew Schofield) #1

Whenever I take a photo of my receipt, the preview that appears after taking the photo displays correctly, but the image that is attached to a transaction always gets rotated by 90°. This happens whether I have got my screen rotation locked or not.
I also noticed this in the verification workflow where I had to take my driving license photo “the wrong way round” in order to make it appear correctly.

Other apps do not appear to have the same behaviour, and the only thing I can think of is the Android app is not interpreting the exif orientation tag correctly.

(Jon Farquharson) #2

Mine does this also, but if I click the image to open it fully, the rotation is then displayed correctly until closing it again. So it’s only the thumbnail that has the issue…

(Rika Raybould) #3

Yup, it sounds like it’s almost certainly an EXIF orientation issue.

For those following along, smartphone cameras will almost always capture the image to file in the orientation of the physical sensor and then just write the orientation from the accelerometer as an EXIF tag. Same if you try to rotate the image in most basic preview and editing apps as it’s theoretically lossless until you make some kind of final export rather than rewriting the whole file constantly and losing image quality from the jpeg every time.

Almost all image processing or display APIs and utilities nowadays can handle the rotation data but it’s still an issue for anything trying to work directly with the file or less mature image processing libraries. Sounds like whatever is generating the thumbnail is one of these (or is just configured/called incorrectly).

(Tristan Thomas) #4

Thanks! I’m guessing you’re on Samsung phones? They can be a bit unique with how they handle photos :rolling_eyes:

(Andrew Schofield) #6

Actually no. I’m using an LG G2 running cyanogenmod

(Andrew Schofield) #7

By the way, when I look at my transactions through the API and download the image file from aws, I can see that the exif data and image data is correct (in this case the actual image is in the portait orientation, with no exif flag to change the orientation). This suggests that the app is getting it wrong when displaying it, rather than being related to taking the original photo.

(Rika Raybould) #8

Just tested this with some of my own transaction images against the original files on my iPhone, looks like they get processed somewhere in the upload and all EXIF data stripped. I would bet that the rotation gets “burned in” as part of this.

(Andrew Schofield) #9

Are you sure about “all”? My camera details and GPS data are still embedded in my images.
Are your images saved in the corrected orientation, I.e short width long height for a portrait image (as opposed to long width short height with exif rotation flag)?

(Rika Raybould) #10

Let’s start with a sample image of my Apple Pencil (linked so Discourse won’t touch it).

ExifTool describes this as Orientation: Rotate 90 CW. Most applications on iOS, macOS, Windows and Android display this the correct way except when I previewed the image using ShareX while uploading it.

The iOS app displays this image correctly.

However, the Android app fails to rotate in the preview.

And additionally fails to rotate here.

This failure to rotate applies to both images that were uploaded using iOS and Android (camera app and driver dependent?). It looks like I was partially wrong about EXIF data stripping as images uploaded to Monzo as far back as January also exhibit this issue with the same rotation data (though information such as camera model and GPS data has indeed been stripped from older images).

Update: If you’re looking at the API, it seems like image URLs that end in a file extension such as .jpg have had their EXIF data stripped, URLs that do not end in such an extension appear untouched.

(Andrew Schofield) #11

It seems that the camera on my phone is writing out the images in their actual orientation (i.e. without an EXIF orientation flag), however I still see the same as you, where the preview is rotated incorrectly. Unfortunately after rebooting my phone I now no longer see the full image when I tap on it either, I just get a black image popover.

(Sean Pearce) #12

I just noticed this today… Took photos of receipts in portrait, and they display as such on phone.
However, in the Monzo thumbnail, are not rotated correctly.
If you click the full view of the image in Monzo, it is then displayed correctly.

Galaxy S3, Lollipop.

(Tristan Thomas) #13

Can you try the newest beta version (1.2.0) to see if this is now fixed? :slight_smile:

(Andrew Schofield) #14

I can report that existing images are still rotated incorrectly in the thumbnail view, and I just get a black popover when I try and view the full image. I’ll try uploading some new images later to see if that works any differently.

(Rika Raybould) #15

Can confirm that my test case was fixed in 1.2.0 and now displays as expected with the Pencil always pointing up.

(Andrew Schofield) #16

OK, after playing some more here’s what I see:

  • New images are rotated correctly in the preview and appear in the full view when I tap on them :thumbsup:
  • Existing images are still rotated incorrectly in the preview, and do not appear in the full view, I just get a black window.

So, I think the bug is squashed, and there is probably something weird going on with my existing images which breaks the full view. I’ll try downloading them from AWS and re-uploading them in the app and see what happens then.

(Tristan Thomas) #17

Thanks for the updates :slight_smile: Looking forward to hear how you get on Andrew.

(Andrew Schofield) #18

Downloading, rotating and uploading them again through the app has fixed all my existing broken images. Took a little while, but my receipts are all readable once more :slight_smile:

OCR of receipts
(Tristan Thomas) #19

Glad you got it working and sorry for the kerfuffle!