-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Mask not resized when using an Image input with tool="sketch" and a shape argument #2054
Comments
@leszekhanusz Can you see if this bug is still present in gradio 3.4, we have made a lot of changes to the sketch tool and i think this should be fixed now. |
Nope, this is not fixed. I just tested with gradio 3.4 and the problem is still there.
|
Will take a look, thanks! |
After a little thinking + discussion, I know why this is happening and we should respect the shape argument when it is provided but we need think a little about how we implement it.\ Problem The reason it isn't being respected is because the shape cropping is handled on the backend (and isn't currently applying to the mask only the image). We can fix that but it still leads to a pretty poor user experience as users of the app (as opposed to authors) don't really have any indication that a shape constraint is being applied. We need some visual indicator that the image (and any additional mask of sketch) will be constrained to a specific shape. Additionally, the current implementation doesn't give much flexibility around how the image is resized and cropped to match the shape argument. Proposal I propose adding a crop window when the I think we should also consider augmenting the |
We could also resize images (maintaining dimensions) on the server if images are uploaded that are too large. Depends on the reason for setting |
As an example, here is how it is done for the automatic1111 fork of Stable Diffusion:
An integrated cropping tool designed to keep a specific aspect ratio and giving the user the control and visibility about the potential cropping would definitely be a great addition to this library. What would be absolutely needed in that case is that the shape of the image could be defined by other inputs (the width and height inputs in that case) |
@leszekhanusz Sounds good. In this case the dimensions would be updatable via the |
Just tested this on the latest version of gradio and it's fixed now: It was probably fixed as a result of PR #3277! There's a separate issue (visible in the screenshot) of the image being resized incorrectly (but that is an existing issue here: #3093), so I'll go ahead and close this issue. I'll also move your suggestions about cropping to this issue here: #1451 |
Describe the bug
if we use an Image input with
tool="sketch"
and ashape
argument, then only the image is resized to the shape and not the mask.Is there an existing issue for this?
Reproduction
Screenshot
No response
Logs
System Info
Severity
annoying
The text was updated successfully, but these errors were encountered: