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.
TypeScript ai-photo-editorcomfyui-alternativegenerative-fillimage-editingimage-generationinpaintinglinuxlocal-aimacosmcpmcp-servernano-banana-alternativeofflinephoto-editorprivacyqwen-imageqwen-image-2-1stable-diffusion-cppvulkanwindows
ui: the image laid on the page, versions joined by silk
Gabriele Lozupone725a19f5a1a8
diff --git a/src/components/Stage.tsx b/src/components/Stage.tsxindex 097310f..d42878a 100644--- a/src/components/Stage.tsx+++ b/src/components/Stage.tsx@@ -12,7 +12,7 @@ import {addAsReference, addResult, cancelJob, focusPrompt, getState, itemSource, removeSessionItem, reusePrompt, selectedItem, selectItem, sessionLabels, sessionLinks, setState, submitRequest, toastError, toastInfo, useStore, type SessionItem,} from "../lib/store";import type { GenerationRecord, GenerationRequest, JobView, LutEntry, Mode, Size } from "../lib/types";-import { Cocoon, Hatch, reducedMotion } from "./Cocoon";+import { Cocoon, Hatch, reducedMotion, SilkSpin } from "./Cocoon";import { CompareFrame, CompareFullscreen } from "./Compare";import { LutBar, LutButton, LutOverlay } from "./Lut";import { IconButton, Popover, useFit } from "./ui";@@ -671,7 +671,13 @@ const R = 5;function Joint({ kind, hot }: { kind: LinkKind; hot: boolean }) {if (kind === "start") return <span className="joint break" aria-hidden />;if (kind === "branch" || kind === "combine") return <span className="joint gap" aria-hidden />;- return <span className={`joint link ${kind === "variant" ? "dashed" : ""} ${hot ? "hot" : ""}`} aria-hidden />;+ // Two silk threads between the thumbnails' centres (25 px down the 50 px frame).+ return (+ <svg className={`joint silk ${kind === "variant" ? "dashed" : ""} ${hot ? "hot" : ""}`} viewBox="0 0 22 50" aria-hidden>+ <path className="t1" d="M-3 25 C 5 30.5, 17 30.5, 25 25" />+ <path className="t2" d="M-3 24 C 6 20, 15 21, 25 26" />+ </svg>+ );}function linkText(link: TimelineLink | undefined, labels: Record<string, string>): string {@@ -827,14 +833,15 @@ function Timeline({ labels }: { labels: Record<string, string> }) {}}onPointerCancel={endDrag}>+ <span className="frame-box"><span className="frame-img">{src && <img src={urls.sourceThumb(src)} alt="" draggable={false} />}{pendingSrc && <img className="dim" src={urls.sourceThumb(pendingSrc)} alt="" draggable={false} />}- {pending && !failed && (+ {pending && !failed && (job && job.status !== "queued" ? <JobCocoon job={job} request={it.request} /> : (<span className="frame-state">- {job && job.status !== "queued" ? <JobRing job={job} request={it.request} /> : <Loader2 className="spin" size={16} />}+ <SilkSpin size={30} /></span>- )}+ ))}{failed && (<span className="frame-state"><X size={16} />@@ -846,6 +853,13 @@ function Timeline({ labels }: { labels: Record<string, string> }) {</span>)}</span>+ {selected === it.key && (+ <svg className="frame-silk" viewBox="0 0 60 60" aria-hidden>+ <rect className="ring" x="1" y="1" width="58" height="58" rx="17" />+ <rect className="run" x="1" y="1" width="58" height="58" rx="17" pathLength={200} />+ </svg>+ )}+ </span><span className="frame-label">{mode && MODE_ICON[mode]}{labels[it.key]}@@ -860,20 +874,17 @@ function Timeline({ labels }: { labels: Record<string, string> }) {);}-/** The whole job's progress in the timeline, the same percentage as its card. */-function JobRing({ job, request }: { job: JobView; request?: GenerationRequest | null }) {+/** The whole job's progress in the timeline, the same percentage as its card: a tiny cocoon+ * that fills as the job advances, with the number under it. */+function JobCocoon({ job, request }: { job: JobView; request?: GenerationRequest | null }) {const { pct } = useJobPercent(job, request);- return <Ring frac={pct / 100} />;-}--function Ring({ frac }: { frac: number }) {- const r = 8;- const c = 2 * Math.PI * r;return (- <svg width="20" height="20" viewBox="0 0 20 20" aria-hidden>- <circle cx="10" cy="10" r={r} fill="none" stroke="currentColor" strokeOpacity="0.25" strokeWidth="2.5" />- <circle cx="10" cy="10" r={r} fill="none" stroke="currentColor" strokeWidth="2.5" strokeDasharray={c} strokeDashoffset={c * (1 - frac)} strokeLinecap="round" transform="rotate(-90 10 10)" />- </svg>+ <>+ <span className="frame-state">+ <SilkSpin size={28} fill={pct / 100} />+ </span>+ <span className="frame-pct">{Math.floor(pct)}</span>+ </>);}diff --git a/src/styles.css b/src/styles.cssindex 76840a0..f1b8a0b 100644--- a/src/styles.css+++ b/src/styles.css@@ -132,15 +132,19 @@ svg { display: block; flex: none; }/* ---------- main ---------- */.main { flex: 1; display: flex; min-height: 0; position: relative; }-.stage { container: stage / inline-size; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 24px 12px; position: relative; }+.stage { container: stage / inline-size; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 24px 12px; position: relative; isolation: isolate; }+/* a soft light on the paper behind the image */+.stage::before { content: ""; position: absolute; left: 50%; top: 44%; width: min(1100px, 120%); height: 80%; transform: translate(-50%, -50%); background: radial-gradient(ellipse at center, var(--glow) 0%, transparent 62%); pointer-events: none; z-index: -1; }.stage-frame { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }-.stage-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background-image: conic-gradient(var(--checker) 25%, transparent 0 50%, var(--checker) 0 75%, transparent 0); background-size: 16px 16px; }+.stage-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius-img); background-image: conic-gradient(var(--checker) 25%, transparent 0 50%, var(--checker) 0 75%, transparent 0); background-size: 16px 16px; }/* the line under the image: version, what made it, compare, actions *//* under the image: what it is (one centred line), then what you can do with it */-.stage-bar { width: 100%; max-width: 820px; display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 10px; }+.stage-bar { width: 100%; max-width: 820px; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 14px; }+/* the image laid on the page like a print */+.stage .image-box, .stage .compare-box { border-radius: var(--radius-img); box-shadow: var(--print); }.stage-meta { max-width: 100%; justify-content: center; min-height: 24px; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }-.stage-meta .ver { font-weight: 600; color: var(--text); font-size: 13px; flex: none; }-.stage-meta .mode { flex: none; padding: 1px 7px; border-radius: 6px; background: var(--surface); color: var(--text-2); }+.stage-meta .ver { font-weight: 620; color: var(--text); font-size: 13px; letter-spacing: -0.01em; flex: none; }+.stage-meta .mode { flex: none; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--text-2); font-size: 11.5px; line-height: 18px; }.stage-meta .stage-prompt { flex: 0 1 auto; min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.stage-meta .dims { flex: none; }.stage-meta .dims-seg { flex: none; padding: 2px; border-radius: 8px; }@@ -148,8 +152,11 @@ svg { display: block; flex: none; }.actions { display: flex; gap: 2px; flex: none; }.actions .sep { width: 1px; background: var(--border); margin: 6px 4px; }+/* what you can do with the image: one card under it */+.stage-bar .actions { padding: 4px; border-radius: 16px; background: var(--bg); box-shadow: var(--lift); animation: rise 0.6s var(--ease) both; }+.stage-bar .actions .icon-btn { width: 32px; height: 32px; }/* main actions: icon + word */-.act { height: 34px; padding: 0 10px; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }+.act { height: 32px; padding: 0 11px; border-radius: 11px; transition: background 0.15s, color 0.15s; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }.act:hover, .act.active { background: var(--surface); color: var(--text); }@container stage (max-width: 600px) {.act { width: 34px; padding: 0; justify-content: center; }@@ -157,14 +164,15 @@ svg { display: block; flex: none; }}.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--text-3); text-align: center; }-.empty h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); margin: 0; }+.empty { animation: rise 0.9s var(--ease) both; }+.empty h1 { font-size: 30px; font-weight: 640; letter-spacing: -0.03em; color: var(--text); margin: 0; }.empty p { margin: 0; font-size: 14px; }.empty p.tip { font-size: 12px; max-width: 420px; text-align: center; opacity: 0.75; }.empty .hint { display: flex; gap: 18px; font-size: 12px; margin-top: 4px; }.empty .hint span { display: flex; gap: 6px; align-items: center; }/* pending job */-.pending { position: relative; max-width: 100%; max-height: 100%; border-radius: 10px; background: var(--surface); overflow: hidden; display: grid; place-items: center; isolation: isolate; }+.pending { position: relative; max-width: 100%; max-height: 100%; border-radius: var(--radius-img); background: var(--bg); box-shadow: var(--lift); overflow: hidden; display: grid; place-items: center; isolation: isolate; }/* the cocoon (components/Cocoon.tsx): silk on a canvas, the edit's source inside it */.cocoon { position: absolute; inset: 0; z-index: 0; transition: opacity 0.8s; }.cocoon.dim { opacity: 0.32; }@@ -182,10 +190,10 @@ svg { display: block; flex: none; }/* a fresh result seen through the logo, which grows until it is the image (Hatch) */.hatch { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; }.hatch-body { position: relative; z-index: 1; flex: 1; min-width: 0; min-height: 0; display: flex; }-.hatch-canvas { position: absolute; z-index: 0; border-radius: 10px; background: var(--surface); }-.hatch-veil { position: absolute; z-index: 2; border-radius: 10px; overflow: hidden; pointer-events: none; }+.hatch-canvas { position: absolute; z-index: 0; border-radius: var(--radius-img); background: var(--bg); box-shadow: var(--lift); }+.hatch-veil { position: absolute; z-index: 2; border-radius: var(--radius-img); overflow: hidden; pointer-events: none; }.hatch-veil svg { display: none; position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; will-change: opacity, filter; }-.hatch-veil path { fill: var(--surface); }+.hatch-veil path { fill: var(--bg); }.hatch-ink { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: visible; }.hatch-ink path { fill: var(--text); }.pending-title { color: var(--text); font-weight: 600; font-size: 14px; }@@ -242,25 +250,51 @@ svg { display: block; flex: none; }.arcs path { fill: none; stroke: var(--text-3); stroke-opacity: 0.45; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: stroke-opacity 0.15s; }.arcs path.hot { stroke: var(--text); stroke-opacity: 1; stroke-width: 2; }.joint { flex: none; }-.joint.link { width: 18px; height: 1.5px; background: var(--text-3); opacity: 0.45; margin-top: 24px; }-.joint.link.hot { opacity: 1; background: var(--text); }-.joint.link.dashed { background: none; border-top: 1.5px dashed var(--text-3); height: 0; }-.joint.link.dashed.hot { border-top-color: var(--text); }+/* versions joined by silk: two threads, the second one swaying a little */+.joint.silk { width: 22px; height: 50px; color: var(--text-3); overflow: visible; }+.joint.silk path { fill: none; stroke: currentColor; stroke-linecap: round; transition: stroke-opacity 0.15s; }+.joint.silk .t1 { stroke-width: 1.1; stroke-opacity: 0.6; }+.joint.silk .t2 { stroke-width: 0.7; stroke-opacity: 0.35; animation: silk-sway 3.2s ease-in-out infinite; }+.joint.silk.dashed .t1 { stroke-dasharray: 2 3; }+.joint.silk.hot { color: var(--text); }+.joint.silk.hot .t1 { stroke-opacity: 1; }+.joint.silk.hot .t2 { stroke-opacity: 0.55; }+@keyframes silk-sway { 50% { transform: translateY(1.5px); } }.joint.gap { width: 16px; }/* a new image: the line breaks */-.joint.break { width: 29px; height: 32px; margin-top: 8px; background: linear-gradient(var(--border), var(--border)) center / 1px 100% no-repeat; }-.frame { flex: none; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0 2px; color: var(--text-3); }-.frame-img { width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: var(--surface); position: relative; display: grid; place-items: center; outline: 2px solid transparent; outline-offset: 2px; }+.joint.break { width: 29px; height: 32px; margin-top: 9px; background: linear-gradient(var(--border-2), var(--border-2)) center / 1px 100% no-repeat; }+.frame { flex: none; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 0 2px; color: var(--text-3); }+.frame-box { position: relative; display: block; }+.frame-img { width: 50px; height: 50px; border-radius: 13px; overflow: hidden; background: var(--bg); box-shadow: var(--lift); position: relative; display: grid; place-items: center; outline: 2px solid transparent; outline-offset: 3px; transition: outline-color 0.15s, transform 0.2s var(--ease); }.frame-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }-.frame-img img.dim { opacity: 0.35; filter: blur(1px); }+.frame-img img.dim { opacity: 0.25; filter: blur(2px) grayscale(1); }.frame-state { position: relative; color: var(--text); display: grid; place-items: center; }-.frame:hover .frame-img { outline-color: var(--surface-3); }-.frame.sel .frame-img { outline-color: var(--text); }+.frame-img .frame-state { margin-top: -9px; }+.frame-img .silk-spin ellipse { stroke-width: 1.15px; }+.frame-img .silk-spin rect { opacity: 0.22; }+.frame-img .silk-spin .silk-fill { opacity: 0.7; }+.frame-pct { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; font-size: 9.5px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }+.frame:hover .frame-img { transform: translateY(-1px); }+.frame:hover:not(.sel) .frame-img { outline-color: var(--surface-3); }+/* the shown version: a silk thread runs round it */+.frame-silk { position: absolute; left: -5px; top: -5px; width: 60px; height: 60px; overflow: visible; pointer-events: none; color: var(--text); }+.frame-silk rect { fill: none; stroke: currentColor; }+.frame-silk .ring { stroke-width: 1; stroke-opacity: 0.28; }+.frame-silk .run { stroke-width: 1.7; stroke-linecap: round; stroke-dasharray: 46 154; animation: silk-orbit 3.6s linear infinite; }+@keyframes silk-orbit { to { stroke-dashoffset: -200; } }+@media (prefers-reduced-motion: reduce) {+ .frame-silk .run, .joint.silk .t2 { animation: none; }+ .frame-silk .ring { stroke-opacity: 1; stroke-width: 1.5; }+}/* what the shown version was made from */.frame.src .frame-img { outline: 2px dashed var(--text-3); }.frame.sel { color: var(--text); }-.frame-label { display: flex; align-items: center; gap: 3px; font-size: 11px; line-height: 1; white-space: nowrap; }-.frame-badge { position: absolute; right: 3px; bottom: 3px; width: 17px; height: 17px; border-radius: 5px; background: var(--invert-bg); color: var(--invert-text); display: grid; place-items: center; }+.frame-label { display: flex; align-items: center; gap: 3px; font-size: 11px; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }+.frame-badge { position: absolute; right: 3px; bottom: 3px; width: 17px; height: 17px; border-radius: 6px; background: var(--invert-bg); color: var(--invert-text); display: grid; place-items: center; }++/* things arrive out of a soft blur, like the words of the prompt enhancer */+@keyframes rise { from { opacity: 0; filter: blur(6px); transform: translateY(4px); } to { opacity: 1; filter: none; transform: none; } }+@media (prefers-reduced-motion: reduce) { .stage-bar .actions, .empty { animation: none; } }/* ---------- composer ---------- */.composer-wrap { flex: none; padding: 0 24px 18px; display: flex; justify-content: center; }@@ -469,10 +503,10 @@ pre.diag { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font.compare-overlay .seg button { height: 26px; padding: 0 10px; color: rgba(255, 255, 255, 0.8); }.compare-overlay .seg button:hover { color: #fff; }.compare-overlay .seg button.on { background: rgba(255, 255, 255, 0.92); color: #111; box-shadow: none; }-.compare-box { position: relative; border-radius: 6px; overflow: hidden; touch-action: none; user-select: none; background-image: conic-gradient(var(--checker) 25%, transparent 0 50%, var(--checker) 0 75%, transparent 0); background-size: 16px 16px; }+.compare-box { position: relative; border-radius: var(--radius-img); overflow: hidden; touch-action: none; user-select: none; background-image: conic-gradient(var(--checker) 25%, transparent 0 50%, var(--checker) 0 75%, transparent 0); background-size: 16px 16px; }.compare-box.slider { cursor: ew-resize; }/* the area painted for the next edit, drawn like in the inpaint editor */-.stage-mask { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6px; mix-blend-mode: difference; opacity: 0.75; pointer-events: none; }+.stage-mask { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: var(--radius-img); mix-blend-mode: difference; opacity: 0.75; pointer-events: none; }.compare-box.slider.zoomed { cursor: inherit; }.compare-img, .compare-diff { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }/* Areas the original did not cover (expanded edges) show the checkerboard. */