1. What is the problem? Be very detailed.
On the latest version of ODK Collect (v2022.1.1), when pictures are taken as portrait (phone vertical, height > width) we receive them as landscape (width > height) and thus deformed.
We have been using this form for one and half year without issue. This is only since we recently updated ODK Collect that the problem appeared.
It also happens with the phone of my colleague, which is completely different than mine.
We are using orx:max-pixels in the XForm, but I made some tests without it, and got the same behaviour.
If the picture is taken as landscape (phone horizontal) the picture is fine.
If I review the pictures in the finalized form before sending it, they are all displayed properly and not deformed (whether they are portrait or landscape).
2. What app or server are you using and on what device and operating system? Include version numbers.
ODK Collect v2022.1.1 + plain XForm XML
Custom server based on the OpenRosa protocol
3. What you have you tried to fix the problem?
- remove orx:max-pixels from the XForm
- intercept the binary data as soon as it is received and check the size with two different Java libraries, in order to make sure this is not a post-processing issue on the server side.
4. What steps can we take to reproduce the problem?
- Create a simple form taking a picture
- Take the picture with the phone horizontal
- Take the picture with the phone vertical
- Send it to a server
5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
Attaching two pictures, one taken as portrait (deformed, since it is received as landscape with width and height inverted), the other as landscape (behaving properly).
As I understand it happens no matter if you use
orx:max-pixels or not?
Could you attach the original photos here (not only a screenshot of them)?
Hello, thanks for your quick answer!
I downloaded the pictures and actually they look ok:
- in Firefox
- with the GNOME (Linux) image viewer
So this is most likely not an ODK Collect issue, I am sorry.
What is strange is that both:
invert width and height, so I am quite puzzled.
I will keep investigating, but I attach the pictures, just in case you notice something wrong.
Apologies again for the false alert.
Maybe of interest:
GIMP says that it contains "EXIF rotation metadata", so maybe this is why Java does not understand height and width properly.
But we never had this issue before updating ODK Collect, with the same code on the server side.
Can you please try v2022.1.2 which was released a couple of days ago? We have made some changes to fix another resizing issue which might possibly interact with what you're experiencing.
We have just tested with v2022.1.2, and we get the same behaviour (pictures attached).
It seems that we now have to deal with an EXIF tag for rotation, which the basic Java image libraries don't understand on the server side.
The photos you attached here do not contain any exif data. Probably you downloaded it from aggregate? I'm pretty sure aggregate ignores exif data or even removes it at all.
It is not from Aggregate, this is the raw data received from ODK Collect via the OpenRosa protocol, without any processing (this data collection is just part of a bigger system)
When I open the latest portrait test (attached below again, for convenience), taken with ODK Collect v2022.1.2
I am not very familiar with pictures metadata, but there seem to be this "Orientation Right-top" metadata.
I also attach the picture in a zip, in order to make sure the forum software did not process the uploaded picture.
1646300008845.zip (49.5 KB)
Next week I will set up a much simpler system, without the production data, in order to focus on this.
Again, I don't see this as an ODK issue, I am just trying to understand what has changed compared with a few months ago (the system is used for seasonal data collection, so there is not much data collection in winter, and that is why we notice only now, after updating the phones)
Many thanks for your help!
Now I see it.
in the past we used to rotate images based on their exif data (orientation) what was wrong because it is not our responsibility and it caused other bugs. The component that displays images should do that properly taking into account exif data.
Ok, thanks a lot, this is clear now! So, I will have to deal with it on the server side.
Does it mean we will now have the GPS tags preserved when resizing the picture with orx:max-pixels in the XForm? (this is an issue we had, and we had to reintegrate some GPS data into the pictures during post-processing)
Marking as solved.
Yes, now the process consists of three steps:
- Copy exif data from the original image
- Resize image if needed
- Add original exif data to the newly generated image
This is not perfect because when exif data contains info about image size we do not update it so the new smaller image will contain wrong data in exif about width/height. This is something we are going to fix too but so far no one has complained so probably it's not a big problem.