feat: expose img2img CLI flags for Flux.2 Klein#358
Merged
filipstrand merged 1 commit intofilipstrand:mainfrom Feb 17, 2026
Merged
feat: expose img2img CLI flags for Flux.2 Klein#358filipstrand merged 1 commit intofilipstrand:mainfrom
filipstrand merged 1 commit intofilipstrand:mainfrom
Conversation
Add --image-path and --image-strength to mflux-generate-flux2, following the same pattern used by flux_generate.py (Flux.1). Three additions: 1. parser.add_image_to_image_arguments(required=False) 2. reference_image_path=args.image_path in DimensionResolver.resolve() 3. image_path + image_strength passed to model.generate_image()
Owner
|
Should have been there from the start :). Will make a 0.16.5 release with this included. |
Contributor
Author
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add --image-path and --image-strength to mflux-generate-flux2, following the same pattern used by flux_generate.py (Flux.1).
Three additions:
Summary
The
Flux2KleinPython class already implements full img2img support via_prepare_img2img_latents(), acceptingimage_pathandimage_strengthparameters in
generate_image(). However, themflux-generate-flux2CLIdoes not register
--image-path/--image-strength, so users cannotaccess img2img from the command line.
This PR adds 3 lines to
flux2_generate.pyto expose these flags,following the exact same pattern used by
flux_generate.py(Flux.1):parser.add_image_to_image_arguments(required=False)reference_image_path=args.image_pathinDimensionResolver.resolve()image_path=args.image_path+image_strength=args.image_strengthingenerate_image()When
--image-pathis not provided, behavior is identical to upstream.Why this is different from
mflux-generate-flux2-editFlux.2 Klein already has an image-conditioned editing CLI
(
mflux-generate-flux2-editwith--image-paths), but that is afundamentally different operation from img2img:
--image-path)--image-paths)--image-strength, then denoises — the result follows the spatial layout of the original--image-strength(0.0 = ignore input, 1.0 = pure noise) controls how much of the original is preservedmflux-generate-flux2(this PR)mflux-generate-flux2-edit(already exists)Every other generation command in MFLUX that supports img2img
(Flux.1, FIBO, Qwen Image, Z-Image) already exposes
--image-path/--image-strengthin its CLI. Flux.2 Klein is the only model where theunderlying class supports it but the CLI does not — this PR closes that gap.
Testing
Tested on Apple Silicon with
flux2-klein-4b(distilled) andflux2-klein-base-9b(undistilled). Verified:--image-path+--image-strengthworks correctly--width/--heightare omittedChecklist
flux2_generate.py)flux_generate.py