Skip to content

Flux2 pipelines: expose the hardcoded 1MP condition-image downscale threshold (max_area)#14127

Open
sqhuang wants to merge 1 commit into
huggingface:mainfrom
sqhuang:add-flux2-max-area
Open

Flux2 pipelines: expose the hardcoded 1MP condition-image downscale threshold (max_area)#14127
sqhuang wants to merge 1 commit into
huggingface:mainfrom
sqhuang:add-flux2-max-area

Conversation

@sqhuang

@sqhuang sqhuang commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Exposes the condition/reference image area threshold in the FLUX.2 pipelines as a public max_area argument, instead of hardcoding 1024 * 1024.

Currently Flux2Pipeline, Flux2KleinPipeline and Flux2KleinKVPipeline silently downscale any condition/reference image larger than ~1MP before conditioning (e.g. if image_width * image_height > 1024 * 1024 in pipeline_flux2_klein.py). There is no public way to keep higher-resolution conditioning — the only workaround today is patching the private image_processor._resize_to_target_area.

Fixes the inability to override the reference-image resolution cap without touching private image-processor internals. Useful for users who want to condition on higher-resolution references.

Simple change, i think no-issue-needed :).

Changes

  • Add a max_area: int = 1024**2 argument to call on Flux2Pipeline, Flux2KleinPipeline and Flux2KleinKVPipeline, and use it in place of the hardcoded 1024 * 1024 threshold.
  • Mirrors the existing max_area parameter of FluxKontextPipeline for API consistency.
  • Default value is unchanged, so existing behavior is fully preserved (fully backward compatible).

Before submitting

Who can review?

@yiyixuxu @sayakpaul @DN6 @dg845 @asomoza — Small, backward-compatible API addition to the FLUX.2 pipelines exposing the existing max_area behavior as a public argument.

@github-actions github-actions Bot added pipelines size/S PR with diff < 50 LOC labels Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Hi @sqhuang, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Fixes #1234) to the PR description so the issue is linked. See the contribution guide for more details. If this PR intentionally does not fix a tracked issue, a maintainer can add the no-issue-needed label to silence this reminder.

The condition/reference image downscale threshold was hardcoded to
1024*1024 in Flux2Pipeline, Flux2KleinPipeline and Flux2KleinKVPipeline,
silently downscaling any reference image above ~1MP. Expose it as a
max_area __call__ argument (default unchanged), mirroring the existing
max_area parameter of FluxKontextPipeline.
@sqhuang sqhuang force-pushed the add-flux2-max-area branch from de10be4 to 1989b08 Compare July 7, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pipelines size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant