Low resolution image using android.media.action.IMAGE_CAPTURE

I created a form to capture images. here is wha it looks like

But the returned image is really small with low resolution. Here is what i got from the android.media.action.IMAGE_CAPTURE documentation:

The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap object in the extra field. This is useful for applications that only need a small image. If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri value of EXTRA_OUTPUT

My exemple has ‘Pictures’ as output. but it doesn’t seem to work
I may be missing something.

1 Like

Hi @Gilbert

Thanks for your question.

Android returns a thumbnail image (small and low quality) because it doesn’t know where to save it. The output location must be a full path to the folder, ideally in the shared external storage of the phone (where any app can create files).

The problem is that this path can be different depending of the phone’s brand and Android version, so even if you specify a full path output in this form, then some phones might not have that folder and Android will return the thumbnail.

Also, depending of the Android version, you will need to enable the write external storage permission (<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />) in your manifest file. More info in the Android documentation.

In order to ensure that any phone have the output path and can save the full image size, we need to code a solution. I’ve open an issue for prioritisation and research.

An alternative solution that you can do right now is to use the Enketo image picker widget. Please have a look at this form sample. I think it can give the option to get picture from camera or file system.
One more thing, when using this widget, remember to enable this permission in your manifest file: <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>



Thank you @Jennifer_Quesada .
This github url you shared is not reacheable by me. Maybe i need more access.
Let me review my solution and revert.
Have a great day!

Sorry about that @Gilbert, this is the Enketo image picker sample from the link:

<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
		<h:title>Photos on Android - Demo Form</h:title>

				<photos-on-android id="photos-on-android">

			<bind nodeset="/photos-on-android/my_photo" type="binary"/>

		<upload ref="/photos-on-android/my_photo" mediatype="image/*">
			<hint>Select a picture or take a photo</hint>
			<label>Image widget</label>