Image and video generation
Last updated
Edit Reference Images with FLUX.2 Klein on Mac
With FLUX.2 Klein editing, specify what to change and what to preserve
FLUX.2 Klein editing takes a source photo and reference images, changes the specified details, and saves a result image.
If you want to change only a mug’s color while keeping its handle and shadow, a prompt1 for creating a new image is not enough. FLUX.2 Klein editing takes a source image and reference images, then changes the specified details.
MFLUX is a community project, separate from BFL’s official runner. The 4B model file is about 15 GB and the 9B file about 32 GB, and their licenses differ. First use 4B to check the input path and saved result; compare a 9B variant only if its license and hardware requirements fit your use.
Assign a role to each source and reference image
To change the cup’s color while keeping its shadow and nearby leaves, include the source mug photo as an editing input. Unlike text-to-image, which creates a new scene, editing tells the model which parts of an existing image to change and which to keep.
Place the front photo mug-front.png, side photo mug-side.png, and dark-blue swatch blue-swatch.png in the example folder. Name their roles in the prompt—the edit target, shape reference, and color reference—so you can tell which instructions the result followed.
The MLX2 Metal3 path supports macOS 14 or later, so do not assume the steps below work on Intel Macs or earlier macOS versions. BFL’s official FLUX.2 repository documents model families and licenses; MFLUX’s documentation describes its editing CLI4, mflux-generate-flux2-edit.

Check model size and usage terms
The MFLUX FLUX.2 documentation lists Klein 4B and 9B for editing, plus 9B-KV for reference-image editing. A 4B file of about 15 GB or a 9B file of about 32 GB does not mean that runtime5 memory use equals the file size. Open apps, image count and resolution, and runtime workspace also use memory. Check unified memory6 and disk space before downloading.
Check the license for each model. BFL’s official repository distinguishes Klein 4B under Apache-2.0 from the 9B family under non-commercial terms. For commercial use, review the selected model repository’s license and BFL’s current terms.
Use flux2-klein-4b for the first run. When comparing 9B or 9B-KV, change only the model option and keep the same source and editing instruction. The 9B-KV cache is used in an editing path that includes reference images.
Install MFLUX and run an edit
The MFLUX README describes installing the tool with uv. On an Apple Silicon Mac with Homebrew, run brew install uv, verify it with uv --version, and install MFLUX with uv tool install --upgrade mflux. Check the installation and options with uv tool list and the edit CLI help, then put the three image files in the working folder. The model downloads automatically on first run, so you need a network connection and disk space.
brew install uv
uv --version
uv tool install --upgrade mflux
uv tool list
mflux-generate-flux2-edit --helpmflux-generate-flux2-edit --model flux2-klein-4b --image-paths mug-front.png mug-side.png blue-swatch.png --prompt 'Change only the mug color to match blue-swatch.png. Preserve the mug shape, handle, table, cast shadow, and nearby leaves.' --steps 4 --seed 42
Compare the result with the source, then change one condition at a time
When the command finishes, check whether the terminal shows an output path and an image file was created, then compare the mug and surrounding shadow in Preview. If the mug did not change, check the file paths and prompt first. If the leaves or shadow changed too, name the details to preserve more specifically and rerun with the same source and seed.
Changing steps, model size, seed, and reference-image count all at once makes it hard to tell which condition affected the result. First narrow the requested change in the prompt and save another result; compare 9B only if needed. A larger model does not guarantee a better result for every input and needs more memory and disk space.
If the process exits or reports insufficient memory, close other image-generation apps and browsers and retry with the same 4B settings. If it still fails, check MFLUX’s current macOS, Python, and model support requirements and inspect the error log. Moving to 9B can increase the memory burden when memory is already insufficient.

Choose a different workflow when preservation accuracy matters
Place the source and result side by side and inspect whether the mug outline, handle, shadow, and leaves remain. Reference-image editing does not guarantee pixel-level preservation. For work where accuracy matters, such as a product color, review the output and consider a separate design-editing step.
To compare generation time, record the same Mac, MFLUX version, model revision, source, resolution, and prompt, then warm up and time several runs. Generation time is a different metric from a text LLM7’s token8 rate.
If 4B fits your memory and license requirements, start by testing that setup. Compare 9B or its KV variant only if repeated edits of the same photo fail to preserve the required details and your hardware has room. The starting point is to choose an input path suited to creating a new image or changing part of an existing one.
Official implementation references
Check the official references below for installation, support, and model-use terms. Record the model and runner versions when reproducing the workflow.
Terminology notes
Prompt — The input text sent to a model. For generative models it describes the desired result and strongly shapes the output.
Back to the textMLX — Apple’s machine-learning framework, which runs models using memory shared by the CPU and GPU on Apple Silicon.
Back to the textMetal — Apple’s low-level technology for graphics and parallel GPU computation.
Back to the textCLI — Short for Command-Line Interface: operating a program by entering commands in a terminal.
Back to the textRuntime — The software environment that provides facilities needed while a program runs. In local AI, it can also refer to a model execution engine.
Back to the textUnified memory — An architecture where the CPU and GPU share one physical memory pool.
Back to the textLarge language model — A model trained on large text datasets to learn language patterns and process or generate text in context.
Back to the textToken — A unit into which a model divides input or output for processing.
Back to the text
Frequently asked questions
- What should you check first in this article?
- FLUX.2 Klein editing takes a source photo and reference images, changes the specified details, and saves a result image.
- How much memory does it need?
- The MFLUX FLUX.2 documentation lists Klein 4B and 9B for editing, plus 9B-KV for reference-image editing. A 4B file of about 15 GB or a 9B file of about 32 GB does not mean that runtime memory use equals the file size. Open apps, image count and resolution, and runtime workspace also use memory. Check unified memory and disk space before downloading.
- Where can you check the conditions and sources?
- The MLX Metal path supports macOS 14 or later, so do not assume the steps below work on Intel Macs or earlier macOS versions. BFL’s official FLUX.2 repository documents model families and licenses; MFLUX’s documentation describes its editing CLI, mflux-generate-flux2-edit.
Read next
Image and video generation
FLUX or Qwen Image: choose a model for the job
Image and video generation
Local image generation: software, hardware and your first image
Executable programs and extensions
Run local AI with MLX on Apple Silicon: frameworks and model tools explained
Image and video generation
Make your first image locally with FLUX.3 Klein
