Skip to content
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

Price proof: convert images to webp before upload ? #5952

Open
raphodn opened this issue Nov 27, 2024 · 3 comments
Open

Price proof: convert images to webp before upload ? #5952

raphodn opened this issue Nov 27, 2024 · 3 comments

Comments

@raphodn
Copy link
Member

raphodn commented Nov 27, 2024

Story

In the Open Prices project we've been discussing the idea to convert as much of our images to webp. Why ? No quality impact, but a big size impact (factor of 5-7), all the seconds reduced to upload an image to the server.

This conversion is already done in the web app - prices.openfoodfacts.org.
What about doing it in the mobile app ?

Especially if we want to seperate the "proof upload" and "price upload" actions, and have the proof uploaded as soon as possible so that the server can return the "predictions" (proof type, price/product/location extraction...)

Linked to openfoodfacts/open-prices#577

@monsieurtanuki
Copy link
Contributor

In the Open Prices project we've been discussing the idea to convert as much of our images to webp. Why ? No quality impact, but a big size impact (factor of 5-7), all the seconds reduced to upload an image to the server.

Could be done on the server side when receiving the image file, right?

This conversion is already done in the web app - prices.openfoodfacts.org. What about doing it in the mobile app ?

flutter is not very good converting images: something like slow actions that freeze the app.

Especially if we want to seperate the "proof upload" and "price upload" actions, and have the proof uploaded as soon as possible so that the server can return the "predictions" (proof type, price/product/location extraction...)

That would mean discarding the offline mode. Or maintaining both online and offline mode. What's supposed to happen with slow connectivity?

@raphodn
Copy link
Member Author

raphodn commented Nov 28, 2024

Could be done on the server side when receiving the image file, right?

The idea is to have both. But if done on the mobile, users would send a ~1MB image, instead of a 10MB image. Good for slow connectivity, no ?

flutter is not very good converting images: something like slow actions that freeze the app.

I'm no expert, but we do background tasks already in the mobile app, we want to put some AI, so an image conversion shouldn't be that hard ?

@monsieurtanuki
Copy link
Contributor

Good for slow connectivity, no ?

Actually we don't really care about speed as we do that in background.

an image conversion shouldn't be that hard

It's not hard, it takes resources, for instance we have to save and keep the image in BMP (instead of directly in JPEG) most of the time for performance reasons, and eventually convert it in JPEG but in background (cf. image_compute_container.dart)

And there are two different modes. Let's say the user selects a photo from the gallery. We support only JPEG here. Then:

  • if the user leaves the photo untouched, we send it as is (no conversion)
  • if the user crops the photo, we have to tap dance with the BMP then JPEG conversion (here it would be easy to convert to WEBP instead)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 💬 To discuss and validate
Development

No branches or pull requests

2 participants