gradio: [ImageMask] - Brush missing

Describe the bug

I don’t know what I’m doing wrong, or if it’s a bug, but I’m trying to use the brushes to draw the mask as is done in this example: https://huggingface.co/spaces/OzzyGT/diffusers-image-fill

But when I load exactly the same code it doesn’t work. In this docs https://www.gradio.app/docs/gradio/imageeditor#demos i tried upload image here but has same problem.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr
with gr.Blocks() as app:   
    imageMask = gr.ImageMask(
            type="pil",
            label="Input Image",
            crop_size=(1024, 1024),
            canvas_size=(1024, 1024),
            layers=False,
            sources=["upload"],
            interactive=True,
            width=400,
            height=400,

        )

app.launch(inbrowser=True)

Screenshot

image

Logs

N/A

System Info

Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 5.9.1
gradio_client version: 1.5.2

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.4.0
audioop-lts is not installed.
fastapi: 0.115.4
ffmpy: 0.4.0
gradio-client==1.5.2 is not installed.
httpx: 0.27.0
huggingface-hub: 0.25.2
jinja2: 3.1.3
markupsafe: 2.1.5
numpy: 1.26.3
orjson: 3.10.6
packaging: 24.1
pandas: 2.2.2
pillow: 11.0.0
pydantic: 2.8.2
pydub: 0.25.1
python-multipart: 0.0.19
pyyaml: 6.0.1
ruff: 0.5.6
safehttpx: 0.1.6
semantic-version: 2.10.0
starlette: 0.41.2
tomlkit: 0.12.0
typer: 0.12.3
typing-extensions: 4.12.2
urllib3: 2.2.2
uvicorn: 0.30.5
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2024.2.0
httpx: 0.27.0
huggingface-hub: 0.25.2
packaging: 24.1
typing-extensions: 4.12.2
websockets: 12.0

Severity

Blocking usage of gradio

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Hi @elismasilva! Please set fixed_canvas=True if you want the canvas size to be fixed and not resize based on the input image!

To recap the new behavior:

  • Image editor always resizes the canvas to match the size of the uploaded image
  • canvas_size is just the initial canvas size
  • Setting a height is the total height of the component. If this is smaller than the height of an uploaded image, the component may not fit everything.

Thanks, it worked at first. I’m going to implement the component in my interface, if there’s any problem I’ll get back to you.