docs: replace README language switcher SVGs with PNG assets

This commit is contained in:
ussoewwin
2026-05-19 03:29:31 +09:00
parent 4cc245daab
commit 5b5cac8d90
13 changed files with 145 additions and 34 deletions
+2 -3
View File
@@ -1,9 +1,8 @@
# ComfyUI-Nunchaku QwenImage&ZImageTurboLoraStack
<p align="center">
<a href="README.md"><img src="assets/lang-en-active.svg" alt="English" height="28"></a>
&nbsp;&nbsp;
<a href="README.zh.md"><img src="assets/lang-zh-inactive.svg" alt="中文" height="28"></a>
<a href="README.md"><img src="assets/lang-en-active.png" alt="English" height="36"></a><!--
--><a href="README.zh.md"><img src="assets/lang-zh-inactive.png" alt="中文" height="36"></a>
</p>
A ComfyUI custom node for loading and applying LoRA (Low-Rank Adaptation) to Nunchaku Qwen Image and Z-ImageTurbo models. ComfyUI Nodes 2.0 compatible. **Requires Nunchaku 1.2.0+ and ComfyUI-Nunchaku 1.2.0+ for v4 functionality.**
+2 -3
View File
@@ -1,9 +1,8 @@
# ComfyUI-Nunchaku QwenImage&ZImageTurboLoraStack
<p align="center">
<a href="README.md"><img src="assets/lang-en-inactive.svg" alt="English" height="28"></a>
&nbsp;&nbsp;
<a href="README.zh.md"><img src="assets/lang-zh-active.svg" alt="中文" height="28"></a>
<a href="README.md"><img src="assets/lang-en-inactive.png" alt="English" height="36"></a><!--
--><a href="README.zh.md"><img src="assets/lang-zh-active.png" alt="中文" height="36"></a>
</p>
用于 Nunchaku Qwen Image 和 Z-ImageTurbo 模型的 ComfyUI 自定义节点,支持加载和应用 LoRA(低秩适配)。兼容 ComfyUI Nodes 2.0。**v4 功能需要 Nunchaku 1.2.0+ 和 ComfyUI-Nunchaku 1.2.0+。**
Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

-10
View File
@@ -1,10 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="28" viewBox="0 0 56 28" role="img" aria-label="English">
<defs>
<linearGradient id="en-on" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#5b9fd4"/>
<stop offset="100%" stop-color="#3d7eb5"/>
</linearGradient>
</defs>
<rect width="56" height="28" rx="14" fill="url(#en-on)"/>
<text x="28" y="18" text-anchor="middle" fill="#ffffff" font-family="Segoe UI, Helvetica, Arial, sans-serif" font-size="12" font-weight="700">EN</text>
</svg>

Before

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

-4
View File
@@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="28" viewBox="0 0 56 28" role="img" aria-label="English">
<rect width="56" height="28" rx="14" fill="#f4f6f8" stroke="#c5cdd6" stroke-width="1.5"/>
<text x="28" y="18" text-anchor="middle" fill="#6b7785" font-family="Segoe UI, Helvetica, Arial, sans-serif" font-size="12" font-weight="600">EN</text>
</svg>

Before

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

-10
View File
@@ -1,10 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="28" viewBox="0 0 56 28" role="img" aria-label="-‡">
<defs>
<linearGradient id="zh-on" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#d46464"/>
<stop offset="100%" stop-color="#b84848"/>
</linearGradient>
</defs>
<rect width="56" height="28" rx="14" fill="url(#zh-on)"/>
<text x="28" y="18" text-anchor="middle" fill="#ffffff" font-family="Segoe UI, PingFang SC, Microsoft YaHei, sans-serif" font-size="11" font-weight="700">-‡</text>
</svg>

Before

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

-4
View File
@@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="28" viewBox="0 0 56 28" role="img" aria-label="-‡">
<rect width="56" height="28" rx="14" fill="#f4f6f8" stroke="#c5cdd6" stroke-width="1.5"/>
<text x="28" y="18" text-anchor="middle" fill="#6b7785" font-family="Segoe UI, PingFang SC, Microsoft YaHei, sans-serif" font-size="11" font-weight="600">-‡</text>
</svg>

Before

Width:  |  Height:  |  Size: 376 B

+141
View File
@@ -0,0 +1,141 @@
"""Generate language switcher PNG assets (GitHub-safe, no SVG CJK text)."""
from __future__ import annotations
from pathlib import Path
from PIL import Image, ImageDraw, ImageFont
ROOT = Path(__file__).resolve().parents[1]
OUT = ROOT / "assets"
W, H = 220, 44
SEG_W = W // 2
R = 12
PAD = 3
FONT_EN = Path(r"C:\Windows\Fonts\segoeuib.ttf")
FONT_ZH = Path(r"C:\Windows\Fonts\msyhbd.ttc")
FALLBACK = Path(r"C:\Windows\Fonts\arialbd.ttf")
def _font(path: Path, size: int) -> ImageFont.FreeTypeFont:
if path.exists():
return ImageFont.truetype(str(path), size)
return ImageFont.truetype(str(FALLBACK), size)
def _rounded_rect(
draw: ImageDraw.ImageDraw,
xy: tuple[int, int, int, int],
radius: int,
fill: tuple[int, ...],
corners: tuple[bool, bool, bool, bool] = (True, True, True, True),
) -> None:
x0, y0, x1, y1 = xy
if x1 <= x0 or y1 <= y0:
return
tl, tr, br, bl = corners
r = min(radius, (x1 - x0) // 2, (y1 - y0) // 2)
if r < 1:
draw.rectangle(xy, fill=fill)
return
if x1 - r > x0 + r:
draw.rectangle([x0 + r, y0, x1 - r, y1], fill=fill)
if y1 - r > y0 + r:
draw.rectangle([x0, y0 + r, x1, y1 - r], fill=fill)
if tl:
draw.pieslice([x0, y0, x0 + 2 * r, y0 + 2 * r], 180, 270, fill=fill)
else:
draw.rectangle([x0, y0, x0 + r, y0 + r], fill=fill)
if tr:
draw.pieslice([x1 - 2 * r, y0, x1, y0 + 2 * r], 270, 360, fill=fill)
else:
draw.rectangle([x1 - r, y0, x1, y0 + r], fill=fill)
if br:
draw.pieslice([x1 - 2 * r, y1 - 2 * r, x1, y1], 0, 90, fill=fill)
else:
draw.rectangle([x1 - r, y1 - r, x1, y1], fill=fill)
if bl:
draw.pieslice([x0, y1 - 2 * r, x0 + 2 * r, y1], 90, 180, fill=fill)
else:
draw.rectangle([x0, y1 - r, x0 + r, y1], fill=fill)
def _draw_segment(
img: Image.Image,
index: int,
label: str,
active: bool,
palette: str,
font: ImageFont.FreeTypeFont,
) -> None:
draw = ImageDraw.Draw(img)
x0 = index * SEG_W
x1 = x0 + SEG_W
box = (x0 + PAD, PAD, x1 - PAD, H - PAD)
corners = (index == 0, index == 1, index == 1, index == 0)
if active:
fill = (52, 112, 204, 255) if palette == "en" else (212, 68, 94, 255)
_rounded_rect(draw, box, R, fill, corners)
gloss_h = max((box[3] - box[1]) // 2, 6)
_rounded_rect(
draw,
(box[0], box[1], box[2], box[1] + gloss_h),
R,
(255, 255, 255, 42),
corners,
)
text_color = (255, 255, 255, 255)
else:
_rounded_rect(draw, box, R, (240, 242, 245, 255), corners)
text_color = (82, 90, 99, 255)
bbox = draw.textbbox((0, 0), label, font=font)
tw, th = bbox[2] - bbox[0], bbox[3] - bbox[1]
tx = x0 + (SEG_W - tw) // 2
ty = (H - th) // 2 - 1
draw.text((tx, ty), label, font=font, fill=text_color)
def _make_switcher(en_active: bool) -> Image.Image:
img = Image.new("RGBA", (W, H), (0, 0, 0, 0))
track = Image.new("RGBA", (W, H), (0, 0, 0, 0))
td = ImageDraw.Draw(track)
_rounded_rect(td, (2, 2, W - 2, H - 2), R + 2, (210, 214, 220, 255), (True, True, True, True))
_rounded_rect(td, (3, 3, W - 3, H - 3), R + 1, (248, 249, 251, 255), (True, True, True, True))
img = Image.alpha_composite(img, track)
font_en = _font(FONT_EN, 22)
font_zh = _font(FONT_ZH, 21)
_draw_segment(img, 0, "EN", en_active, "en", font_en)
_draw_segment(img, 1, "中文", not en_active, "zh", font_zh)
return img
def _split_halves(full: Image.Image) -> tuple[Image.Image, Image.Image]:
return full.crop((0, 0, SEG_W, H)), full.crop((SEG_W, 0, W, H))
def main() -> None:
OUT.mkdir(parents=True, exist_ok=True)
en_view = _make_switcher(en_active=True)
zh_view = _make_switcher(en_active=False)
en_l, en_r = _split_halves(en_view)
zh_l, zh_r = _split_halves(zh_view)
en_l.save(OUT / "lang-en-active.png", optimize=True)
en_r.save(OUT / "lang-zh-inactive.png", optimize=True)
zh_l.save(OUT / "lang-en-inactive.png", optimize=True)
zh_r.save(OUT / "lang-zh-active.png", optimize=True)
en_view.save(OUT / "lang-switch-en.png", optimize=True)
zh_view.save(OUT / "lang-switch-zh.png", optimize=True)
print("Wrote PNG assets to", OUT)
if __name__ == "__main__":
main()