Photo rotation - is it just me?

1. What is the problem? Be very detailed.
When taking photos with ODK Collect images don't rotate as I would expect according to the orientation of the device at the time.

An image taken in portrait mode is displayed in landscape format (i.e. on its side). An image taken in landscape mode is displayed in landscape mode (as expected).

I have checked the EXIF data in the images and they claim to be 'Rotate 90 CW' or 'Normal' depending on whether they are portrait or landscape, they are always displayed as 'Normal'.

2. What app or server are you using and on what device and operating system? Include version numbers.
ODK Collect (can't remember when this first occurred, but it's at least a year, looking back at my photos!)
Windows 10
QGIS, Geosetter, MS Explorer, Word - you name it on Win 10, all behave the same

Android 6 and 7 (is this the problem?)

3. What you have you tried to fix the problem?

Tried this on 2 x Samsung Galaxy Note 4 (Android 6) and Sony Xperia Z5 Compact (Android 7) - same result. Viewed the images while still on the device - they are displayed in landscape format

Taken pictures with the same camera app outside ODK Collect - they work as expected and rotate accordingly (see below).

4. What steps can we take to reproduce the problem?
Take a picture in ODK with a form that uses an image (tested with max-pixels and without - same result)

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
The first image was taken with the attached form should be portrait... (and according to the preview while I'm typing this message, it has been rotated to landscape)


Sample-mock.xml (1.1 KB)
This image was taken with the camera app (default, used by ODK Collect)

Why is this a problem?

On one project I have 2500 images... I have had to go through each and manually rotate in an image editor - I tried using autorotate software, but it didn't work!

Maybe it's not an ODK issue, but it hurts :frowning: so hoping it might be a mis-configuration of EXIF or something that can be solved... Seems rude to report it as a bug if it is just me :slight_smile: and then I'll have to live with it...

Out of hundreds of photos taken with tens of devices, I see most rotated correctly and very few If any are rotated incorrectly. I don't know whether screen rotation was set to auto or locked in landscape (we lock in portrait, but end users will be end users...)

I definitely remember seeing some photos taken with the device camera in wrong rotation. These go straight to Google photos outside of ODK.

1 Like

There is one issue in ODK Collect that we are aware of https://github.com/getodk/collect/issues/4571 so that's probably the reason.

1 Like

Hi @Grzesiek2010
Thanks for this - apologies for the delay in responding, I've been out doing fieldwork and making sure I take only 'landscape' orientated images :slight_smile:

Do you have any indication of when this might be integrated into a release? - looks like the issue has been closed, which is great.

Thanks for your ongoing support. Much appreciated.

The issue is not closed it's still open. I don't know when it will be fixed, maybe I will find some time to work on it soon but even if I do that (or someone else) it would be released no sooner than in January.

Thanks - sorry, I've noticed that one part of the issue was closed but mistook that for a fix :slight_smile:

Appreciate the update on timescales - you're a busy man, so please don't take that as more pressure!

2 Likes

Thanks for letting us know that it's a problem for you. It definitely makes it more important when real users complain about it.

3 Likes

I searched for this a month ago and didn't see anything, but I have had the same issue (and 6000 photos to deal with, so I feel your pain)

The fix for me was:

  • Run a batch conversion in Irfanview and on the JPG save options deselect "Reset EXIF orientation flag".
    • You can resize here as well or change quality, or do nothing, but the output will orient correctly.
    • The corrected files will still have EXIF flag 'Right Top' (or the other one if you rotated the other direction)
  • Option 2, to not change the images, but view them correctly is to deselect the Irfanview Properties/Settings option "Auto-rotate image according to EXIF info (if available)” and then they will orient correctly. Not a permanent fix obviously as the images also display incorrectly in MSPaint, Edge, Chrome.

I found the issue only affected images that weren't annotated. Images that weren't annotated, either from device camera or an external camera (sent via Nikon Snapbridge) end up sideways, with EXIF tag 'Right Top'

3 Likes

I think I was premature in saying that my Irfanview batch fixed the issue as some later user images were still oriented wrongly. I'll have to take some known orientations and test.

This is what I'm seeing from photos taken on an SM-T865, Collect 2021.3.4, without markup:

  • Taking the photo in any orientation displays it correctly after capture,
  • The OK/Retry screen preview displays correctly in the position captured, except for an image taken in portrait, upside down, which then previews inverted, and rotating the tablet to portrait, upright, it again flips to be inverted. Selecting OK then displays it correctly.

Device orientation, how they render & EXIF flags:

  • Landscape, upright: displays correctly, EXIF Orientation: Top-left (=1?)
  • Portrait, upright: displays rotated 90° CW (or 270° CCW), EXIF Orientation: Right-top (=6?)
  • Landscape, upside down: displays rotated 180°, EXIF Orientation: Bottom-right (=3?)
  • Portrait, upside down: displays rotated 90° CCW (or 270° CW), EXIF Orientation: Left-bottom (=8?)

@seewhy perhaps you can use imagemagick or similar to batch process your images based on the exif orientation flag?

1 Like

Hi,
A tip is in this topic : Connecting Central to ReDash dashboard - #7 by Rudy
Cordially,

This should be fixed in the new beta. Thanks for reporting the issue and please let us know whether the fix does what you expect.

Thanks @LN
Great that it is (most likely) fixed.

Hopefully I won't need to use the very helpful tip from @Rudy to get things rotated correctly - I did it manually in the end and my eyes hurt afterwards! All my attempts to do it automatically were unreliable...

Thanks to all the team for working on this :slight_smile:

I must get myself another google account to join the BETA testing (oh and another device, and probably another personality).

1 Like

I've dusted off an old handset and will sign in with a different account to test this, thanks @LN, it will save me a lot of headaches too.

Edit:
Samsung Galaxy S5 SM-G900F, Android 11 (Lineage), default camera application

ODK Collect V2022.1 Beta 2

Tested capture & choose image, and annotate capture, with max-pixels=4000 (sensor is 5312x2988, annotated images 1920x1080 screen resolution)):

Portrait_up_0deg_cap_markup
Landscape_90CW_cap_markup
Landscape_90CCW_cap_markup
Portrait_180CW_cap_markup
Portrait_up_0deg_capture
Landscape_90CW_capture
Landscape_90CCW_capture
Portrait_180CW_capture
Portrait_up_0deg_select
Landscape_90CW_select
Landscape_90CCW_select
Portrait_180CW_select

All 12 images were correctly oriented when opened in Irfanview with auto-rotate according to EXIF checked. (A sample opened in Chrome / Edge / MSPaint were also correct)

Annotated images had minimal EXIF tags (Filename, ImageWidth, ImageLength, ExifOffset, Orientation, Lightsource), all capture data was stripped, orientation = 0

Non annotated images had full EXIF tags and orientation as:

Portrait_up_0deg_capture - Right top
Landscape_90CW_capture - Bottom right
Landscape_90CCW_capture - Top left
Portrait_180CW_capture - Left bottom
Portrait_up_0deg_select - Right top
Landscape_90CW_select - Bottom right
Landscape_90CCW_select - Top left
Portrait_180CW_select - Left bottom

Note: re image filesizes -

  • ODK image EXIF tags show the original image dimensions as (5312x2988) even though the image is 4000x2250)
  • The non annotated images were ~4mb ea, resaving with JPG quality 75 resulted in a ~0.5mb file with correct pixel dimensions
    • Comparing ODK to different quality for one image: ODK: 3.8mb, Q100 4.2mb Q99 3.7mb, Q90 0.9mb, Q75 0.4mb)
  • The annotated images were ~150kb, resaving as JPG quality 75 resulted in little change
  • Because this OS has a different camera default I can select the capture resolution, which resulted in filesizes as (ODK / Q75) (no max-pixel applied as under 4000):
    • EXIF tags show correct image dimensions
    • Quality "High"
      • 3264x1836: 1712 / 317 kb
      • 2560*1920: 1396 / 270 kb
      • 2048*1152: 843 / 185 kb
      • 1280*720: 364 / 94 kb
    • Quality "Standard"
      • 3264x1836: 499 / 334 kb
1 Like

Grabbed the v2022.1.0 release and all my non annotated photos are the right way up. Thanks to all!

1 Like