Skip to content

Image Edit Feature (Fixes #1352) #1439

Merged
ramkrishna2910 merged 5 commits intolemonade-sdk:mainfrom
Phqen1x:image-edit
Mar 30, 2026
Merged

Image Edit Feature (Fixes #1352) #1439
ramkrishna2910 merged 5 commits intolemonade-sdk:mainfrom
Phqen1x:image-edit

Conversation

@Phqen1x
Copy link
Copy Markdown
Contributor

@Phqen1x Phqen1x commented Mar 25, 2026

I have added functionality to the electron app/webapp to use the /edits endpoint built into lemonade-server. Now the image generator panel has the ability to edit reference images as well using a prompt.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds image edit (and variation-from-reference) support to the Electron/web app by wiring the UI to the server’s /images/edits (and /images/variations) endpoints, and updates the sd-server backend behavior for variations to use the edits endpoint with embedded inference parameters.

Changes:

  • Update SDServer::image_variations to forward to sd-server’s /v1/images/edits and embed steps/cfg_scale via <sd_cpp_extra_args>.
  • Extend the Image Generation panel UI with mode selection, reference-image upload/preview, and new “Edit” / “Variations” actions on generated images.
  • Add/adjust CSS for new image action buttons and reference upload UI; update package-lock.json.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/cpp/server/backends/sd_server.cpp Changes variations forwarding behavior and prompt construction for sd-server multipart requests.
src/app/src/renderer/components/panels/ImageGenerationPanel.tsx Adds image edit/variation workflows, reference image handling, and updated send/save behavior.
src/app/styles.css Introduces styles for new image action buttons and reference upload UI.
src/app/package-lock.json Lockfile update (adds transitive dependency metadata).
Files not reviewed (1)
  • src/app/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/app/src/renderer/components/panels/ImageGenerationPanel.tsx Outdated
Comment thread src/cpp/server/backends/sd_server.cpp Outdated
Comment thread src/cpp/server/backends/sd_server.cpp Outdated
Comment thread src/app/styles.css Outdated
Comment thread src/app/src/renderer/components/panels/ImageGenerationPanel.tsx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • src/app/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/cpp/server/backends/sd_server.cpp
Comment thread src/app/src/renderer/components/panels/ImageGenerationPanel.tsx
@ramkrishna2910
Copy link
Copy Markdown
Contributor

@Phqen1x I tried using this in the webapp, I am using SD-Turbo and when I provide a prompt with an image to edit I am seeing a new image being generated rather than the passed image being edited. See below:

image

@Phqen1x
Copy link
Copy Markdown
Contributor Author

Phqen1x commented Mar 25, 2026

@Phqen1x I tried using this in the webapp, I am using SD-Turbo and when I provide a prompt with an image to edit I am seeing a new image being generated rather than the passed image being edited. See below:
image

I've run into this as well, but at the time I just assumed it was because the model I was accidentally using, SD-1.5, was simply too small and not powerful enough to do a good job. I just asked Claude what it thought was the issue, and it believes that the reason is because sd-server maybe uses different endpoints for reference images that isn't being used here. I am not really sure how to find what endpoint in sd-server needs to be used for the SD-Turbo, SDXL-Turbo, and other SD models to work. I know the Flux-2-Klein models do work, though.

@sawansri
Copy link
Copy Markdown
Collaborator

sawansri commented Mar 26, 2026

@Phqen1x I tried using this in the webapp, I am using SD-Turbo and when I provide a prompt with an image to edit I am seeing a new image being generated rather than the passed image being edited. See below:
image

I've run into this as well, but at the time I just assumed it was because the model I was accidentally using, SD-1.5, was simply too small and not powerful enough to do a good job. I just asked Claude what it thought was the issue, and it believes that the reason is because sd-server maybe uses different endpoints for reference images that isn't being used here. I am not really sure how to find what endpoint in sd-server needs to be used for the SD-Turbo, SDXL-Turbo, and other SD models to work. I know the Flux-2-Klein models do work, though.

If the issue lies in sd-server endpoints that are not implemented/unsupported, you can probably place a proxy in between the image editor and backend to capture the exact payload the editor is sending to sd-server in order to debug. Additionally, look for errors in the backend with debug logs enabled (--log-level debug).

I had to do this to reverse engineer/implement the requests claude code was sending via Anthropic's Messages API to the llamacpp backend.

I can share the script I used for the proxy if you are interested.

@Phqen1x
Copy link
Copy Markdown
Contributor Author

Phqen1x commented Mar 26, 2026

@Phqen1x I tried using this in the webapp, I am using SD-Turbo and when I provide a prompt with an image to edit I am seeing a new image being generated rather than the passed image being edited. See below:
image

I've run into this as well, but at the time I just assumed it was because the model I was accidentally using, SD-1.5, was simply too small and not powerful enough to do a good job. I just asked Claude what it thought was the issue, and it believes that the reason is because sd-server maybe uses different endpoints for reference images that isn't being used here. I am not really sure how to find what endpoint in sd-server needs to be used for the SD-Turbo, SDXL-Turbo, and other SD models to work. I know the Flux-2-Klein models do work, though.

If the issue lies in sd-server endpoints that are not implemented/unsupported, you can probably place a proxy in between the image editor and backend to capture the exact payload the editor is sending to sd-server in order to debug. Additionally, look for errors in the backend with debug logs enabled (--log-level debug).

I had to do this to reverse engineer/implement the requests claude code was sending via Anthropic's Messages API to the llamacpp backend.

I can share the script I used for the proxy if you are interested.

I would appreciate if you could send that script! Thanks for the input, Sawan.

@sawansri
Copy link
Copy Markdown
Collaborator

@Phqen1x I tried using this in the webapp, I am using SD-Turbo and when I provide a prompt with an image to edit I am seeing a new image being generated rather than the passed image being edited. See below:
image

I've run into this as well, but at the time I just assumed it was because the model I was accidentally using, SD-1.5, was simply too small and not powerful enough to do a good job. I just asked Claude what it thought was the issue, and it believes that the reason is because sd-server maybe uses different endpoints for reference images that isn't being used here. I am not really sure how to find what endpoint in sd-server needs to be used for the SD-Turbo, SDXL-Turbo, and other SD models to work. I know the Flux-2-Klein models do work, though.

If the issue lies in sd-server endpoints that are not implemented/unsupported, you can probably place a proxy in between the image editor and backend to capture the exact payload the editor is sending to sd-server in order to debug. Additionally, look for errors in the backend with debug logs enabled (--log-level debug).
I had to do this to reverse engineer/implement the requests claude code was sending via Anthropic's Messages API to the llamacpp backend.
I can share the script I used for the proxy if you are interested.

I would appreciate if you could send that script! Thanks for the input, Sawan.

Here you go!
proxy.py

@ramkrishna2910
Copy link
Copy Markdown
Contributor

We could add an edit label to server_models.json and disable the edit UI for non-editing models. So users dont fail by trying SD models.

@kenvandine
Copy link
Copy Markdown
Member

We could add an edit label to server_models.json and disable the edit UI for non-editing models. So users dont fail by trying SD models.

I like that solution, surely this isn't the only case that will bite us.

@ramkrishna2910
Copy link
Copy Markdown
Contributor

@Phqen1x let me know if you want to discuss this further. Really looking forward to the feature :)

@Phqen1x
Copy link
Copy Markdown
Contributor Author

Phqen1x commented Mar 27, 2026

@Phqen1x let me know if you want to discuss this further. Really looking forward to the feature :)

Definitely! The edit label sounds like a great idea. I can work on implementing an edit label and integrating that into this feature tomorrow! I'll let you know if I have any other questions or comments.

@Phqen1x
Copy link
Copy Markdown
Contributor Author

Phqen1x commented Mar 28, 2026

@ramkrishna2910, just implemented the edit label and applied it to the Flux-2-Klein models. None of the other image models included in Lemonade seem to be capable of image editing at this time. It might be nice to display the edit label in the model manager, but we're not displaying anything for the SD models now anyway. Maybe we can do that as a followup PR.

@ramkrishna2910
Copy link
Copy Markdown
Contributor

Yup makes sense. I will take a look at this shortly. :)

@ramkrishna2910
Copy link
Copy Markdown
Contributor

That worked very well!
image

@ramkrishna2910
Copy link
Copy Markdown
Contributor

The coherence is so nice!
Input image:
image

Prompt - Change the graph to blue

Output image:
image

Copy link
Copy Markdown
Contributor

@ramkrishna2910 ramkrishna2910 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great contribution! Super excited for this feature to ship!

@ramkrishna2910 ramkrishna2910 added this pull request to the merge queue Mar 30, 2026
@Phqen1x
Copy link
Copy Markdown
Contributor Author

Phqen1x commented Mar 30, 2026

Glad to hear it! Can't wait to see it shipped as well!

Merged via the queue into lemonade-sdk:main with commit 4fa6064 Mar 30, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants