-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic conversion of image files to .jpg prior to submission to Briefcase or Aggregate. #1173
Comments
The conversion takes place in the class collect\android\activities\FormEntryActivity within the methods onActivityResult() L 629 and saveChosenImage() L 819. |
OK, update. |
@danielsteward Thanks for the great detective work! @mitchellsundt @wbrunette Is it true that Aggregate can only handle JPGs? I'd love some insight as to why that is the case and what potential workarounds are. |
Aggregate can handle any content, but when displaying the little thumbnails on the Submissions pages, it executes this codepath https://github.com/opendatakit/aggregate/blob/master/src/main/java/org/opendatakit/aggregate/servlet/BinaryDataServlet.java#L213 to scale down the image. And that prevents handling anything other than JPG. The underlying library might be able to support more file formats. The code is here: https://github.com/opendatakit/aggregate/tree/master/src/main/java/org/opendatakit/aggregate/util with different implementations for AppEngine (using a Google service) and Tomcat. The Tomcat code uses this library: https://github.com/opendatakit/aggregate-components/tree/master/TomcatUtils which uses a hacked imageio library with a bunch of licensed / proprietary format handlers removed https://github.com/jai-imageio/jai-imageio-core |
And collect shouldn't have any restrictions on file types. |
@mitchellsundt Collect doesn't have restrictions on file types, but it does rename any image to jpg before uploading. https://github.com/opendatakit/collect/blob/master/collect_app/src/main/java/org/odk/collect/android/activities/FormEntryActivity.java#L656 is the relevant line of code. This is bad behavior on the part of Collect and I think we should probably fix it. But it does break Aggregate, so we'd need to get a fix in place first. With the information you provided, would this be contributor friendly? |
I'd be happy to take something like this on if I have guidance from a Java master. That is exactly what I'm looking for here to improve my coding and expand my knowledge. Especially if it is with ODK. |
True. I support this. On the other hand, is there a possibility to manipulate the images from BLOB to a url that the image can be saved in a directory on the file server? Some manipulation of the sort? |
The possibility to store images files in a directory on the server should be great, or maybe just a script to easily convert blob to file. At the moment it's not so easy to get and use collected images. |
@kusaasira @mathieubossaert Agreed that easier access to images on Aggregate would be a nice thing, but it's not relevant to this issue. If you'd like to see this discussed, please file an issue at https://github.com/opendatakit/opendatakit/issues |
Sorry for the "pollution", here is the new issue : getodk/getodk#1313 |
@yanokwa @mathieubossaert the issue getodk/getodk#1313 was closed unanimously hence I thought we would get a better way forward from here. |
@kusaasira This issue is about keeping PNGs submitted by Collect as PNGs instead of changing their extension to jpg. The discussion of image handling on Aggregate is now at getodk/aggregate#164. |
Collect v1.7.1 (but all versions as far as I know), Android v6.0.1, Fairphone 2.
Problem description:
Collect renames all image files to .jpg extension whatever the android device creates and is submitting only .jpgs to Aggregate
Steps to reproduce the problem:
Create an image other than a on the phone and attempt to add it to a form. The image is renamed with a .jpg extension
Expected behavior:
Possibly this IS the expected behaviour although this is connected to other issues with Briefcase and Aggregate and needs to be rationalised across the board. See issue getodk/briefcase#5 and getodk/briefcase#33
If anyone knows what the original purpose of this conversion to .jpg is please comment.
The text was updated successfully, but these errors were encountered: