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
Reduce processed image display/downloading overhead #7486
Comments
Agreed. The name of parameter could be just |
@freddyaboulton yeah, sure. I will make a PR |
We should preserve the file format used during upload if possible see #7657 |
preserve file format during upload add format to image component
preserve file format during upload add format to image component
apologies I wasn't able to run the test suite locally 🙇♂️ hoping maybe someone can take this and run with it? |
Hi @dfl ! Yea someone can get it over the finish line. Thanks for the PR again. |
preserve file format during upload add format to image component
…lot to control format to save image files in (#7680) * WIP re: #7486. Make less PNG-centric. preserve file format during upload add format to image component * more format preservation re: #7486 * lint * lint; add comments; update Plot component * add'l for Plot imaging defaults * Working tests * add changeset * Add code * test * Add code * add changeset * Docstring improvements --------- Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com> Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Is your feature request related to a problem? Please describe.
In the Gradio library, processed images are saved in the PNG format by default, as observed in the
save_img_array_to_cache
andsave_pil_to_cache
functions withingradio.processing_utils
module. This behavior results in significantly larger file sizes compared to the JPEG format: specifically, for 4K images, the PNG files are approximately 10 times larger than their JPEG counterparts. This leads to increased download and displaying times for the front end, adding unnecessary overhead to the user experience.Describe the solution you'd like
To enhance flexibility and efficiency, it would be beneficial to allow users to select the file format for saving images in the Gradio cache. This could be implemented by introducing an additional parameter, such as format, to the constructors of all image-related components.
As an example, in my application I manually modified the default behavior of the aforementioned functions to save images in JPEG format, which significantly improved the results' delivery time and saved extra 10 seconds
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: