[GH-ISSUE #13897] Support Image Editing (Img2Img/Inpainting) pipelines and API options #9093

Closed
opened 2026-04-12 21:56:36 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @larria on GitHub (Jan 25, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/13897

FLUX family (e.g., flux2-klein), excel not just at Text-to-Image generation but also at Image-to-Image editing and structure retention. Currently, there seems to be no direct API parameter to control image editing workflows (like denoising strength/guidance) effectively.

I would like to request support for Image Editing (Img2Img) pipelines.
Specifically, please expose parameters to control the influence of the input image.

Extend the /api/generate endpoint to accept an images parameter for diffusion models, along with a control parameter (e.g., strength or denoising_strength).

Thanks for the recent updates regarding text-to-image capabilities after all!

Originally created by @larria on GitHub (Jan 25, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/13897 FLUX family (e.g., flux2-klein), excel not just at Text-to-Image generation but also at Image-to-Image editing and structure retention. Currently, there seems to be no direct API parameter to control image editing workflows (like denoising strength/guidance) effectively. I would like to request support for Image Editing (Img2Img) pipelines. Specifically, please expose parameters to control the influence of the input image. Extend the /api/generate endpoint to accept an images parameter for diffusion models, along with a control parameter (e.g., strength or denoising_strength). Thanks for the recent updates regarding text-to-image capabilities after all!
GiteaMirror added the feature request label 2026-04-12 21:56:36 -05:00
Author
Owner

@thefanclub commented on GitHub (Jan 26, 2026):

Ollama 0.15.1 on MacOS supports image editing (img2img) in the API. Just add the 'images' parameter to your api call with list of encoded base64 strings (2 images max at this point is seems). Works on both Flux2 [Klein] and Z-Image-Turbo. The parameters to control this is unknown at this point.

Big thank you to the Ollama team for making this possible even on a 8GB Macbook Air. Incredible technology.

<!-- gh-comment-id:3800576329 --> @thefanclub commented on GitHub (Jan 26, 2026): Ollama 0.15.1 on MacOS supports image editing (img2img) in the API. Just add the 'images' parameter to your api call with list of encoded base64 strings (2 images max at this point is seems). Works on both Flux2 [Klein] and Z-Image-Turbo. The parameters to control this is unknown at this point. Big thank you to the Ollama team for making this possible even on a 8GB Macbook Air. Incredible technology.
Author
Owner

@hqnghi88 commented on GitHub (Jan 27, 2026):

print(f"Input Image: {input_image_path}")

payload = {
"model": model,
"prompt": prompt,
"images": [base64_image],
"options": {
"temperature": 0 # Deterministic
}
}

try:
response = requests.post(url, json=payload)
This give me
Input Image: a.jpg
Error: 500
{"error":"model does not support image editing"}
How can it work for you?

<!-- gh-comment-id:3804651578 --> @hqnghi88 commented on GitHub (Jan 27, 2026): print(f"Input Image: {input_image_path}") payload = { "model": model, "prompt": prompt, "images": [base64_image], "options": { "temperature": 0 # Deterministic } } try: response = requests.post(url, json=payload) This give me Input Image: a.jpg Error: 500 {"error":"model does not support image editing"} How can it work for you?
Author
Owner

@thefanclub commented on GitHub (Jan 27, 2026):

NOTE : This is MacOS only at the moment with Ollama 0.15.2:

print(f"Input Image: {input_image_path}")

with open(input_image_path, "rb") as image_file:
    # Encode without base64 PNG headers. Ollama wants string only
    pngImageB64String = base64.b64encode(image_file.read()).decode('utf-8')

ref_images = []
ref_images.append(pngImageB64String)

url = 'http://localhost:11434/api/generate'
payload = {'model' : 'x/flux2-klein:4b', 
        'prompt' : prompt,
        'images' : ref_images,
        'stream' : False
 }

# Add headers
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}

response = requests.post(url, data=json.dumps(payload), headers=headers).json()

print (response)
<!-- gh-comment-id:3805577008 --> @thefanclub commented on GitHub (Jan 27, 2026): NOTE : This is MacOS only at the moment with Ollama 0.15.2: ``` print(f"Input Image: {input_image_path}") with open(input_image_path, "rb") as image_file: # Encode without base64 PNG headers. Ollama wants string only pngImageB64String = base64.b64encode(image_file.read()).decode('utf-8') ref_images = [] ref_images.append(pngImageB64String) url = 'http://localhost:11434/api/generate' payload = {'model' : 'x/flux2-klein:4b', 'prompt' : prompt, 'images' : ref_images, 'stream' : False } # Add headers headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} response = requests.post(url, data=json.dumps(payload), headers=headers).json() print (response) ```
Author
Owner

@larria commented on GitHub (Feb 5, 2026):

Thx a lot bros, it works well!!!!

<!-- gh-comment-id:3851609015 --> @larria commented on GitHub (Feb 5, 2026): Thx a lot bros, it works well!!!!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#9093