gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
30.83k stars 2.3k forks source link

Set up resizing/cropping for `gr.Image` uploads #7929

Open apolinario opened 3 months ago

apolinario commented 3 months ago

Is your feature request related to a problem? Please describe.
Sometimes models only accept a specific width/height dimension and/or proportion as inputs. Currently users have to build this logic on their app.

Describe the solution you'd like
Add to the gr.Image component tooling resizing/cropping to user specified dimensions. As a high level first API suggestion, maybe there could be a width and height limit, and a param that either resizes or crops to that size

pngwn commented 3 months ago

This is supported by the image editor and was removed from the Image component intentionally.

Perhaps we should make sure the ImageEditor component can support this usecase by making sure everything else can be disabled.