Square cropping for image questions

What high-level problem are you trying to solve?
Collecting large quantities of data that include images that will later be used as icons/touch buttons for responses in another form/apps. These images therefore should be square ie length / height ratio of 1:1 and I would also want to specify the exact pixel dimensions, so that I could make these quite small.

Any ideas on how ODK could help you solve it?
max-pixels is currently an option in parameters for image collection. This could be used in conjunction with an appearance option like "crop". This would default/automatically display a square cropped window centered in the current image which was just taken in Collect and would allow users to modify the dimensions manually by touching and dragging as needed. Then they could touch the blue check icon as they normally do. I'm not sure what the cropping needs are of others and if this has come up before


This is kind of how I would envision this to look, but would have a darker but slightly transparent matte over parts of the image that are cropped out and aren't going to be used.

I'm not sure how this would work for image files that have already been taken since that image preview display doesn't show up the same way.

Upload any helpful links, sketches, and videos.
Another option of how it could look was shown in this post here:

That could work as long as the crop could easily be changed. Here is a preview of how the cropping function currently looks on the iPhone Photos app.

1 Like

This could be part of future image annotation tools (text/shape etc, my post here).

An interim suggestion - as part of your roll out can you have the enumerators set their camera aspect to 1:1? This will get you the square images. At least on my samsung device, aspect is preserved when set either in camera app directly or in camera app via image widget. You could also specify an alternate camera app in the form (eg Open Camera) and set that to 1:1 so accidentally changing the aspect in their default camera app for other uses doesn't affect it.

As far as resolution, making them very small with max-pixels to optimise size for choice use only means you'd have no larger image for use elsewhere?

I haven't tried this, but potentially you could capture the image ${the_big_photo}, then drop that value as default into another image field ${the_small_photo} with a calculate on it like concat('path\to\',${the_big_photo} and set max-pixels on that one to something low. This might return you two sizes of the image, but potentially won't work unless you can work out the xform path to the captured image to concat to the filename? (like having to prepend jr:\\images\ for defaults from attachments.)

1 Like