
Imgcli
io.github.swperb由 GitHub 帳號 swperb 發布v0.2.0更新於 Oct 24, 2026
Convert, resize, crop, filter & composite images via the imgcli CLI (lightweight, no deps)
概覽
包裝 imgcli 命令列工具,讓助理轉換、縮放、裁切、套用濾鏡與合成本機圖片檔案。
- 可以做什麼
- 在 PNG、JPEG、BMP、TGA、GIF、PPM、QOI 之間轉換圖片,並可設定品質與格式
- 縮放、裁切、填邊、旋轉、翻轉與轉置圖片,支援整個資料夾的批次處理
- 套用灰階、復古、亮度、對比、模糊、銳化、邊緣偵測等色彩與卷積濾鏡
- 以多個輸入檔案進行疊圖合成、純色填滿與繪製方框
- 讀取圖片尺寸資訊,並列出可用濾鏡及其語法
- 適用情境
- 適合需要為本機圖片產生縮圖、做格式轉換或簡單風格化處理的情況,不必安裝完整影像套件。也適合希望每次轉換只呼叫一個快速、無相依性二進位檔的腳本或代理流程。
- 執行需求
- 以本機 stdio 程序在桌面端執行,透過 npm 套件 imgcli-mcp 安裝。需另外安裝 imgcli 二進位檔(例如用 Homebrew),並放在 PATH 中,或以 IMGCLI_BIN 環境變數指定路徑。不需帳號、金鑰或網路存取。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Imgcli,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
imgcli — command-line image conversion & processing in C
[Install on Smithery] [OpenSSF Scorecard] [Flawfinder C security scan]
ImageMagick's power, ffmpeg's syntax, zero dependencies. A tiny C binary that converts, resizes, crops, filters, and composites images — PNG, JPEG, BMP, TGA, GIF, PPM, QOI — driven by an ffmpeg-style filtergraph. No system libraries; compiles anywhere a C11 compiler exists.
⚡ ~8× faster than ImageMagick on common resize/filter ops, in a 232 KB single binary (~470× smaller) — see the benchmarks. A lightweight alternative to ImageMagick
convertorffmpegfor still images.
What it does: format conversion · resize / scale · crop · pad · rotate · flip · brightness / contrast / saturation / gamma / hue · grayscale · sepia · invert · threshold · box & Gaussian blur · sharpen · Sobel edge detect · emboss · custom convolution kernels · alpha-composite overlay · draw boxes · solid fills.
Design: the same paradigm as ffmpeg — decode → normalize to one common frame format (RGBA) → run a comma-separated filtergraph → encode by output extension.
Benchmarks
imgcli vs ImageMagick on an Apple Silicon Mac (single-threaded, warm cache).
Reproduce with make && bench/bench.sh — see bench/RESULTS.md
for the full method and caveats.
ImageMagick is a far broader 16-bit/HDRI toolkit with 200+ formats; imgcli is a lean 8-bit pipeline that wins on speed, size, and startup — the shape that matters when an agent or script spawns one process per task.
Dependencies & formats
The default build is dependency-free — a single binary that links only the
system C library (libc). Decoding/encoding is handled by the bundled,
public-domain stb and
qoi single-header libraries, compiled
directly in. Nothing to apt install, no shared libraries, no version hell.
- Built-in formats — no dependencies: PNG, JPEG, BMP, TGA, GIF, PPM, QOI. Other formats that can be implemented in plain C (e.g. TIFF) will also be built in and keep the binary dependency-free.
- Formats that need external libraries — opt-in only: WebP, AVIF, HEIC, and JPEG XL
cannot be decoded without large external libraries (libwebp, libavif, libheif, libjxl);
there is no public-domain single-header decoder for them and they are not
practical to hand-roll. If imgcli adds these, it will be strictly via opt-in
build flags (e.g.
make WEBP=1) that link those libraries.
The "zero dependencies" claim applies to the default build, and always will — opt-in format libraries are never compiled into it. A build that enables such a flag is, by definition, no longer dependency-free, and that trade-off is stated at the point you opt in.
Why it's structured this way
Codecs come from the public-domain stb
single-header libraries (third_party/). They're bundled, not linked, so the
tool stays portable and self-contained while still reading/writing the formats
the world actually uses — the same trade-off ffmpeg makes by leaning on codec
libraries instead of reinventing them.
Install
Use it as a native agent tool (MCP)
An MCP server wraps imgcli so AI agents can
call convert_image, probe_image, and list_filters directly — see
mcp/.
Usage
Colours accept #rgb, #rrggbb, #rrggbbaa, 0x…, r-g-b[-a], or names
(red, white, transparent, …). No commas, so they're safe inside a graph.
Filters
Geometry — scale=W:H[:nearest|bilinear|bicubic|lanczos] (-1 keeps aspect;
bicubic/lanczos are high-quality separable resamplers that anti-alias on
downscale and stay sharp on upscale — bilinear is the default),
crop=W:H[:X:Y], pad=W:H[:X:Y[:color]], hflip, vflip,
transpose=90|180|270, rotate=DEG[:color] (arbitrary angle, canvas expands).
Colour — grayscale, invert, sepia, solarize, brightness=V, temperature=V,
contrast=V, saturation=V, gamma=V, hue=DEG, threshold=V, opacity=V, tint=color.
Convolution — blur=R (box), gblur=SIGMA (separable Gaussian),
sharpen[=AMOUNT], edge (Sobel), emboss, convolution=K[:DIV:BIAS]
(custom N×N kernel, e.g. convolution=0 -1 0 -1 5 -1 0 -1 0).
Composite / draw — overlay=X:Y[:INDEX] (alpha "over" compositing of
another -i input), fill=color, drawbox=X:Y:W:H:color[:fill|thickness].
Examples
For AI agents & scripting
imgcli is built to be a reliable tool in an automated pipeline: one self-contained binary, no dependencies, deterministic, non-interactive, and machine-readable. See AGENTS.md for a token-economical recipe sheet.
- Deterministic & non-interactive — never prompts; refuses to overwrite
without
-y; one process per conversion. - Structured output —
--jsonfor results,--quietto silence chatter; stable exit codes (0ok,1runtime error,2usage error). - No network, no subprocesses — safe to run on untrusted inputs in a sandbox.
- Probe without converting —
imgcli --json -info -i file.jpg.
Security
imgcli decodes untrusted image files in C, so memory safety is taken seriously. The codebase has been audited against the OWASP Top 10, common C/CWE classes, and ffmpeg's historical vulnerability classes. Highlights:
- Decompression-bomb safe — dimensions are validated from the header before pixels are decoded; hard caps on size (16384 px/axis, 64 Mpx).
- Integer-overflow-safe allocation through a single capped choke point.
- No protocols/URLs/subprocesses — ffmpeg's worst class (SSRF / file-read via HLS playlists) is structurally impossible here.
- Hardened build (
_FORTIFY_SOURCE, stack protector, PIE/RELRO, format warnings), ASan/UBSan (make asan), and a fuzz harness (make fuzz).
Full threat model, OWASP/CWE mapping, ffmpeg-CVE-class analysis, and dependency policy: SECURITY.md.
Layout
Contributing
Contributor setup, validation targets, filter-registry guidance, and PR expectations live in CONTRIBUTING.md.
Have a question or idea? Use Discussions. For bugs and feature/format requests, open an issue — the templates will guide you.
Support
If imgcli is useful to you, consider sponsoring its development — it funds new formats, security hardening, and maintenance. See SPONSORS.md.
License
The imgcli source is yours to use freely (MIT). The vendored stb
headers are public domain (or MIT, at your option) and the vendored qoi.h is
MIT-licensed; full third-party notices are in
THIRD_PARTY_NOTICES.md.
來源:README.md,提交 767c004
工具
0版本歷史
1- v0.2.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分