Skip to content

nano-banana-pro: respect explicit --resolution when editing images#36880

Merged
vincentkoc merged 3 commits intoopenclaw:mainfrom
shuofengzhang:fix/nano-banana-explicit-resolution
Mar 6, 2026
Merged

nano-banana-pro: respect explicit --resolution when editing images#36880
vincentkoc merged 3 commits intoopenclaw:mainfrom
shuofengzhang:fix/nano-banana-explicit-resolution

Conversation

@shuofengzhang
Copy link
Copy Markdown
Contributor

What changed

  • Fixed skills/nano-banana-pro/scripts/generate_image.py so --resolution is only auto-detected when the flag is omitted.
  • Added auto_detect_resolution and choose_output_resolution helpers to make resolution behavior explicit and testable.
  • Added new tests in skills/nano-banana-pro/scripts/test_generate_image.py covering:
    • auto-detect thresholds (1K/2K/4K)
    • omitted --resolution with input images
    • default behavior without input images
    • explicit --resolution 1K with large input images

Why

  • The script intended to auto-detect resolution only when --resolution is not explicitly provided.
  • Previously, passing --resolution 1K was indistinguishable from the default, so large input images could still be auto-upgraded to 2K/4K.
  • This change makes explicit user choices authoritative and keeps auto-detection as an opt-in default behavior.

Testing

  • source .venv/bin/activate && pytest -q
  • Result: 30 passed

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 5, 2026

Greptile Summary

This PR fixes a long-standing bug in generate_image.py where passing --resolution 1K was indistinguishable from the default, causing large input images to be silently auto-upgraded to 2K/4K even when the user explicitly requested 1K. It also adds normalize_background / normalize_style validation helpers to gen.py so invalid model-specific flags are rejected early with a clear error.

Key changes:

  • --resolution default changed from "1K" to None; resolution logic extracted into testable auto_detect_resolution and choose_output_resolution helpers.
  • New unit tests in test_generate_image.py cover all threshold boundaries and the explicit-vs-omitted resolution distinction.
  • normalize_background / normalize_style helpers in gen.py validate values before the generation loop and return exit code 2 on bad input; existing tests extended to cover these helpers.
  • Minor UX gap: when a valid flag (e.g. --background transparent) is passed for an incompatible model (e.g. dall-e-3), it is silently discarded without any user-visible warning. This is pre-existing behaviour but the new helpers are a good place to surface it.

Confidence Score: 4/5

  • PR is safe to merge; changes are focused, logic is correct, and new tests provide good coverage of the key behaviours.
  • The core bug-fix (distinguishing explicit --resolution from the default) is implemented cleanly and tested at both unit and integration levels. The gen.py validation helpers are straightforward and do not change observable API behaviour for valid inputs. The one-point deduction is for the silent-discard UX gap in normalize_background / normalize_style, which could confuse users who pass flags for incompatible models.
  • skills/openai-image-gen/scripts/gen.py — the normalize helpers silently drop flags for incompatible models without any user-facing warning.

Last reviewed commit: 21b1d59

@vincentkoc vincentkoc force-pushed the fix/nano-banana-explicit-resolution branch from f15fc35 to 0d7b2ef Compare March 6, 2026 15:28
@vincentkoc
Copy link
Copy Markdown
Member

Cleaned this branch up and pushed it back to the PR head.

The active diff is now just the Nano Banana resolution fix plus the changelog entry on top of current main. The unrelated openai-image-gen commits are gone, so the rerunning checks here are the ones that matter.

Keeping #36881 open as the canonical issue until this lands. If you spot any remaining scope drift, call it out and I’ll recheck it quickly.

@vincentkoc vincentkoc merged commit 37a3fb0 into openclaw:main Mar 6, 2026
7 checks passed
mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 6, 2026
* main:
  Mattermost: harden interaction callback binding (openclaw#38057)
  WhatsApp: honor outbound mediaMaxMb (openclaw#38097)
  openai-image-gen: validate --background and --style options (openclaw#36762)
  Docs: align BlueBubbles media cap wording
  Telegram/Discord: honor outbound mediaMaxMb uploads (openclaw#38065)
  CI: run changed-scope on main pushes
  Skills/nano-banana-pro: clarify MEDIA token comment (openclaw#38063)
  nano-banana-pro: respect explicit --resolution when editing images (openclaw#36880)
  CI: drop unused install-smoke bootstrap
  fix(nano-banana-pro): remove space after MEDIA: token in generate_image.py (openclaw#18706)
  docs: context engine
  docs(config): list the context engine plugin slot
  docs(plugins): add context-engine manifest kind example
  docs(plugins): document context engine slots and registration
  docs(protocol): document slash-delimited schema lookup plugin ids
  docs(tools): document slash-delimited config schema lookup paths
  fix(session): tighten direct-session webchat routing matching (openclaw#37867)
  feature(context): extend plugin system to support custom context management (openclaw#22201)
  Gateway: allow slash-delimited schema lookup paths
Saitop pushed a commit to NomiciAI/openclaw that referenced this pull request Mar 8, 2026
…penclaw#36880)

* nano-banana-pro: respect explicit --resolution when editing images

* Changelog: note nano banana resolution fix

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <[email protected]>
jenawant pushed a commit to jenawant/openclaw that referenced this pull request Mar 10, 2026
…penclaw#36880)

* nano-banana-pro: respect explicit --resolution when editing images

* Changelog: note nano banana resolution fix

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <[email protected]>
dhoman pushed a commit to dhoman/chrono-claw that referenced this pull request Mar 11, 2026
…penclaw#36880)

* nano-banana-pro: respect explicit --resolution when editing images

* Changelog: note nano banana resolution fix

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <[email protected]>
senw-developers pushed a commit to senw-developers/va-openclaw that referenced this pull request Mar 17, 2026
…penclaw#36880)

* nano-banana-pro: respect explicit --resolution when editing images

* Changelog: note nano banana resolution fix

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <[email protected]>
V-Gutierrez pushed a commit to V-Gutierrez/openclaw-vendor that referenced this pull request Mar 17, 2026
…penclaw#36880)

* nano-banana-pro: respect explicit --resolution when editing images

* Changelog: note nano banana resolution fix

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <[email protected]>
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 20, 2026
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants