Reduce picture image while we are taking photo with ODK

Hi all,

My question is i am using ODK for data collection and i am using a phone which has 5 MP camera and when i am taking photo it is using maximun resolution of camera. Is there any method so we can chnage size of picture.
I alredy tried with chnaging photo resolution in camera setting but it doesn't work.

Hi All.

Yes, I was wondering about this too and maybe it ties in with the issue I am looking at currently - https://github.com/opendatakit/collect/issues/1173. We could do something about the 2 issues at he same time possibly?

Dan.

Dan i would love to do work on this. However ,I am newbies in this, i neither made any android apps nor worked on java more so i think i can't do much effort.
But still i would like to do work with you might be we both can find out solution.

Hi all, this is a known feature request and work as started at https://github.com/opendatakit/xforms-spec/issues/79 and https://github.com/opendatakit/collect/issues/42.

@Stalker Can you read through those issues and confirm that it's what you had in mind?

@dansteward I don't think this feature request is related to the issue you are working on.

Perfect this is something that I want. Ready to testing anytime,
@yanokwa you are master man, i googled ODK Paper and found only your name there, one more fan has been added in your list.

2 Likes

Hi Stalker, we also had the same issue back then. Since the current version of ODK Collect is still not able to do that, we opted for a third-party Android app. Here's how we did it:

  1. In the Android device, install the app called Camera FV-5 Lite which allows you to set small dimensions for images
  2. In Camera FV-5 Lite app, set your preferred resolution
  3. In the Android device, set Camera FV-5 Lite as the default camera app

It worked well for us for some time now. :slight_smile:

5 Likes

@Abel_Melquiades_Call That's a great tip!

@Stalker if you're comfortable with installing Collect from code, you can try out https://github.com/opendatakit/collect/pull/1210! There's a form AllWidgets.txt that you can use following step 3 here (change the extension to .xml first).

Otherwise, I'll write here when there's a beta available with the feature.

I resolved this problem in my own Collect fork by resizing the images before uploading them, in tasks/instanceUploaderTask - when iterating through the files to upload, check for an image filetype and if you find one, resize it down (using bitmapfactory) until it meets your size requirements.
I felt that approach was likely to be more reliable than trying to do it as part of the image acquisition process, since it happens entirely within Collect.
Nik

As of ODK Collect v1.1.10 (currently in beta), it is possible to specify a maximum size for the long edge of an image at the form level. This means different images within the same form can have different sizes as desired. This is not yet implemented in XLSForm but hopefully will be soon (https://github.com/XLSForm/pyxform/issues/137).

If you'd like to use this feature before XLSForm supports it, you can generate your form as you normally would and then edit the XML to add the size constraint.

Here is a sample form with 4 image prompts: one that's unscaled and three scaled down to long edges of 1024, 640 or 100: max-pixels.xml (1.3 KB)

5 Likes

As of ODK Collect v1.11, it is possible to specify the maximum size for the long edge of all images in the general settings. This setting can be hidden from admin settings. Images are resized immediately when they are taken/selected.

If a particular question in a particular form specifies a maximum size, then the application setting is ignored. For example, if I set the maximum size to 640 in the settings and then use the form below, images will be of size 1024, 777 and 100.

XLSForm still doesn't have an elegant way to specify the max pixels for an individual image. However, I just remembered that a column with name bind::orx:max-pixels can be added. See an example here that caps image sizes to 1024, 777 and 100.

Thanks @Grzesiek2010 for implementing this. :blush: Hopefully it will make uploading on slow connections a little easier.

3 Likes

Well, this is a great news @LN. Thank you for posting it. Excited!

1 Like

Brilliant, that is exactly what I needed and in less than 15 mins!

Thanks everyone for your help, although it sounds like a few people have this issue. We are working in rural Tanzania and Nigeria, so upload speed can be an issue, although things are improving rapidly.

1 Like

Thanks, the bind field helped and also big thanks for the example.

1 Like

Note that this is now possible from the XLSForm:
https://docs.opendatakit.org/form-question-types/#scaling-down-images

1 Like

A post was split to a new topic: Force using back camera