Difference b/n Collect + Enketo - low image resolution

My apologies if this is already covered, I searched for a bunch of related terms and didn't find what I was looking for, nor is it mentioned in the differences doc

1. What is the issue? Please be detailed.
When adding images to a form in Enketo, the resolution depends wholly on the browser zoom state and display panel resolution.

On my a laptop with 1920x1280 panel resolution, with a form that loads default PNGs for annotation, (all PNGs have resolution 2960x2107 to match the largest tablet resolution, all image widgets have `max-pixels=2960'), the PNG returned from Enketo has increased colour depth and image width of:

  • Loaded at 100% - 616px
  • Loaded at 100% and then zoomed to 200% - 1232px but image is just a 1:2 scaled 616px image
  • Loaded at 200% - 1232px
  • Loaded at 300% - 1590px
  • Loaded at 500% - 1635px
    (non linear increases after 200% due to running out of screen to render on)

Testing same on a screen with resolution 3840x1600:
Image width when loaded at different zoom levels (downloaded from unsubmitted form, not form submissions)

  • Loaded at 100% - 616px
  • Loaded at 200% - 1232px
  • Loaded at 250% - 1540px
  • Loaded at 300% - 1848px
  • Loaded at 400% - 2464px
  • Loaded at 500% - 3080px

Of note, all unannotated images downloaded had filename jr___images_SOURCEIMAGENAME-HH_MM_SS.PNG except one at 300%, which downloaded as SOURCEIMAGENAME.PNG, and this image retained the low colour depth, original resolution as uploaded to Central, i.e. it's the original image, I haven't been able to repeat this once off behaviour with the same default image or other images after ~20 tests. Annotated images had filename annotation-SOURCEIMAGENAME-HH_MM_SS.PNG

Non default images uploaded (Click here to upload file (<100mb)) exhibit the same behaviour, eg a 2587px wide JPG at 200% zoom returned a 1232px wide PNG

Impact - Cannot complete a form in web OR edit a submitted form, as any images added/annotated will be extremely low quality, unless an ultrawide display panel is available and the enumerator navigates in the difficult 500% zoom level.

2. What steps can we take to reproduce this issue?
Load a form with an image widget in Enketo, add images at different browser zoom levels and check the resulting image dimensions.

3. What have you tried to fix the issue?
Upload without modifying / upload at different zoom levels

4. Upload any test forms or screenshots below.

Thanks for detailing the current behavior. That's not intentional and I've filed an issue at https://github.com/enketo/enketo-express/issues/447. I'll update when we have a sense of what a fix will look like and when it's likely to come.

@eyelidlessness has fully re-implemented draw/signature/annotate! You can check it out on https://getodk.org/xlsform/. You won't be able to verify submissions but you should see that resizing the window is much more performant and retains the fully information of the annotation.

In the case of annotations, submitted images respect the size of the original image that was annotated. For signatures and drawings, the size matches the maximum canvas size as determined by the theme.

1 Like

Amazing! :clap:t2: @eyelidlessness

I had a quick look and uploaded a large PNG, zoomed to 500%, annotated and downloaded, then reset zoom to 100%, replaced the image with the same PNG, annotated and downloaded, and both look great.

This means some forms that could never have been completed/edited in Enketo now can be, and a slip of the mouse accidentally annotating an image won't destroy it (apart from changing from JPG to PNG)

If Collect was able to do the same (i.e. not limit to screen resolution), and there were text/shape annotation options as well, then image capture/annotation would be just incredible.

3 Likes

Thanks for such quick feedback, I’m glad to hear that it’s working as intended!

I did consider addressing this in the same change, but it felt too far out of scope. But having feedback that the format change is an issue certainly helps. PNG as default is nice because it’s lossless, but I can definitely imagine it being an issue for large-ish photos.

It's not a giant issue per se, but JPG photos will inflate dramatically in size as PNGs vs line drawings which will be smaller and look better as PNG (and that is a small issue in Collect, where a default PNG drawing ends up as a JPG).

If a JPG remained a JPG and a PNG remained a PNG, that would be the best outcome i think

Is there a rationale for Collect image timestamp filenames vs Enketo annotation-HH_MM_SS filenames?

1 Like

The Collect filenames are milliseconds since the Unix epoch, Jan 1 1970. This was selected to balance length and risk of collision across all submissions to a form. Length is an issue because Windows still has a 256 char full path limit. That’s one of the reasons most exports are flat (all submission attachments at the top level rather than in subdirectories by submission id). Another natural option for automatic filenames would be uuids but those are long. Spec proposal: naming media files has more discussion around submission attachment names.

We don’t know what consideration went into the Enketo naming. Collisions across submissions to a form are likely. We’d like to change that default naming scheme but we’re not sure yet whether we’d want to use the Collect approach or design another one that both could follow.

Raising this one again. @eyelidlessness

I had cause to edit a submission to correct a value (not an image), and looking at the change after submitting I saw that all the JPG photos were now annotation-9_0_45.png etc.

Apart from converting to PNG, this also reduced their resolution and dropped them from 2488x1866 (off Collect on device) to 1232x924. (I didn't browser zoom while editing because a) I wasn't interacting with the images and thought they'd be untouched & b) I thought the image being resized was resolved - but perhaps it's not 100%?

Also - downloading an image in Central will return a JPG if it's a JPG, but downloading the image from the image widget in Enketo will return a PNG regardless, with the filename changed from milliseconds from epoch to annotation-xx.

Hi @ahblake
As I understand the conversion takes place in Central right? Or maybe you mean that after editing a form in ODK Collect photos were converted to pngs?

Yes, i was editing a non image field in Central via Enketo and that's what caused the images to be changed.

We've unfortunately decided to revert the resolution-related improvements made to the annotation question type. This had two unintended consequences:

We've tried to fix the existing implementation but have so far been unable to do so without causing other regressions. We've decided it's better to go back to the previous behavior to avoid those two bugs for now.

This change will go out in a Central point release within the next two weeks. I wanted to share this out now so anyone relying on annotation of high-resolution images has a chance to adapt.

1 Like