Skip to content

Should image_compare scale to given width/height? #10441

Description

@yairchu

Describe the bug

In the following:

_n = 100
mo.image_compare(np.random.random([_n, _n]), np.random.random([_n, _n, 3]), width=300, height=300)

A small image comparison widget is created with blank padding next to it to fill the given width and height. Is that intended behavior or should it scale to fill the given space?

Will you submit a PR?

  • Yes

Environment

{
"marimo": "0.23.16",
"editable": false,
"location": "/Users/yairchu/dev/undersampled_add_sub/.venv/lib/python3.13/site-packages/marimo",
"OS": "Darwin",
"OS Version": "25.5.0",
"Processor": "arm",
"Python Version": "3.13.2",
"Locale": "en_US",
"Binaries": {
"Browser": "140.0.7339.134",
"Node": "v23.11.0",
"uv": "0.11.16 (135a36367 2026-05-21 aarch64-apple-darwin)"
},
"Dependencies": {
"click": "8.4.2",
"docutils": "0.23",
"itsdangerous": "2.2.0",
"jedi": "0.19.2",
"markdown": "3.10.3",
"narwhals": "2.24.0",
"packaging": "26.2",
"psutil": "7.2.2",
"pygments": "2.20.0",
"pymdown-extensions": "11.0.1",
"pyyaml": "6.0.3",
"starlette": "1.3.1",
"tomlkit": "0.15.1",
"typing-extensions": "4.16.0",
"uvicorn": "0.52.1",
"websockets": "17.0.1"
},
"Optional Dependencies": {
"anywidget": "0.11.0",
"loro": "1.13.2",
"mcp": "1.29.0",
"openai": "2.52.0",
"pandas": "3.0.5",
"python-lsp-ruff": "2.3.1",
"python-lsp-server": "1.15.0",
"ruff": "0.16.1",
"ty": "0.0.65"
},
"Experimental Flags": {}
}

Code to reproduce

_n = 100
mo.image_compare(np.random.random([_n, _n]), np.random.random([_n, _n, 3]), width=300, height=300)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions