Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

Use real before/after captures for the README examples

Gabriele Lozupone737fd6f7d25f
diff --git a/README.md b/README.md
index 61d557e..d69f935 100644
--- a/README.md
+++ b/README.md
@@ -96,7 +96,7 @@ Every result below came from one sentence in Kokon, with default settings.
| :---: | :---: |
| <img src="docs/media/examples/remove.jpg" alt="Remove people from a beach"><br>**Remove** · *“Remove all the people from the beach”* | <img src="docs/media/examples/replace.jpg" alt="Replace an object"><br>**Replace** · *“Replace the orange car with a blue vintage Vespa scooter”* |
| <img src="docs/media/examples/relight.jpg" alt="Relight a scene"><br>**Relight** · *“Make it golden hour, warm low sunlight”* | <img src="docs/media/examples/restyle.jpg" alt="Restyle a photo"><br>**Restyle** · *“Turn it into a watercolor illustration”* |
-| <img src="docs/media/examples/text.jpg" alt="Change text in a photo"><br>**Text** · *“Change the neon sign to say ‘OPEN LATE’”* | <img src="docs/media/examples/expand.jpg" alt="Expand a photo"><br>**Expand** · *“Expand to 16:9, continue the beach”* |
+| <img src="docs/media/examples/text.jpg" alt="Change text in a photo"><br>**Text** · *“Change the neon sign to say ‘OPEN LATE’”* | <img src="docs/media/examples/expand.jpg" alt="Expand a photo"><br>**Expand** · Expand → 16:9 · *“continue the beach”* |
## Install
diff --git a/docs/media/examples/expand.jpg b/docs/media/examples/expand.jpg
index fb033e7..6f25519 100644
Binary files a/docs/media/examples/expand.jpg and b/docs/media/examples/expand.jpg differ
diff --git a/docs/media/examples/relight.jpg b/docs/media/examples/relight.jpg
index 98ecef0..6c8d496 100644
Binary files a/docs/media/examples/relight.jpg and b/docs/media/examples/relight.jpg differ
diff --git a/docs/media/examples/remove.jpg b/docs/media/examples/remove.jpg
index 8b80377..06a692f 100644
Binary files a/docs/media/examples/remove.jpg and b/docs/media/examples/remove.jpg differ
diff --git a/docs/media/examples/replace.jpg b/docs/media/examples/replace.jpg
index c075b8e..55fe261 100644
Binary files a/docs/media/examples/replace.jpg and b/docs/media/examples/replace.jpg differ
diff --git a/docs/media/examples/restyle.jpg b/docs/media/examples/restyle.jpg
index 78202c1..d3382f5 100644
Binary files a/docs/media/examples/restyle.jpg and b/docs/media/examples/restyle.jpg differ
diff --git a/docs/media/examples/text.jpg b/docs/media/examples/text.jpg
index 4984b68..10633b9 100644
Binary files a/docs/media/examples/text.jpg and b/docs/media/examples/text.jpg differ
diff --git a/scripts/readme/compose_examples.py b/scripts/readme/compose_examples.py
new file mode 100644
index 0000000..e4bd5e4
--- /dev/null
+++ b/scripts/readme/compose_examples.py
@@ -0,0 +1,28 @@
+"""Builds the README before/after images.
+
+Usage: python scripts/readme/compose_examples.py docs/media/raw docs/media/examples
+Reads <name>-before.jpg and <name>-after.png from the first folder and writes
+<name>.jpg (1200x600, side by side, labelled) into the second.
+"""
+import sys, os
+from PIL import Image, ImageOps, ImageDraw, ImageFont
+R, OUT = sys.argv[1], sys.argv[2]
+W, H, GAP = 1200, 600, 12
+PAPER = (247,246,242)
+f = ImageFont.truetype("C:/Windows/Fonts/segoeuib.ttf", 20)
+def tag(im, text, x, y):
+ d = ImageDraw.Draw(im, "RGBA"); w = d.textlength(text, font=f)
+ d.rounded_rectangle([x, y, x+w+20, y+32], 8, fill=(13,13,13,190)); d.text((x+10, y+3), text, font=f, fill="white")
+for n in ["remove","replace","relight","restyle","text","expand"]:
+ b, a = os.path.join(R, f"{n}-before.jpg"), os.path.join(R, f"{n}-after.png")
+ if not os.path.exists(a): print("skip", n); continue
+ cw = (W - GAP) // 2
+ canvas = Image.new("RGB", (W, H), PAPER)
+ for i, p in enumerate([b, a]):
+ im = Image.open(p).convert("RGB")
+ if n == "expand": # keep whole frames: square before, 16:9 after, letterboxed on paper
+ im.thumbnail((cw, H)); x = i*(cw+GAP) + (cw-im.width)//2; y = (H-im.height)//2
+ else:
+ im = ImageOps.fit(im, (cw, H), Image.LANCZOS); x, y = i*(cw+GAP), 0
+ canvas.paste(im, (x, y)); tag(canvas, ["Before","After"][i], x+12, y+12)
+ canvas.save(os.path.join(OUT, f"{n}.jpg"), quality=88, optimize=True); print("ok", n)