Communitygithub.com

cli-anything-gimp 图像编辑CLI

一个基于Pillow的状态化命令行图像编辑工具,专为AI代理和高级用户设计,无需图形界面即可创建和操作图像。

cli-anything-gimp 图像编辑CLI 是什么?

cli-anything-gimp 是一个功能完备的命令行界面,用于图像编辑和合成,核心基于 Python 的 Pillow 库。它支持项目创建、图层管理、画布操作、滤镜应用、绘制操作(文字和矩形)、多种导出预设,并提供交互式 REPL 模式与无头命令行模式。该工具特别适合 AI 代理:所有命令均支持 --json 输出,便于解析;拥有 50 层级的撤销/重做历史;在 GIMP 不可用时自动回退至 Pillow 渲染路径,确保稳定性。典型使用场景包括批量海报生成、自动化图像合成、以及需要版本控制和可复现性的图像处理流水线。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/HKUDS/CLI-Anything/tree/main/skills/cli-anything-gimp

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

cli-anything-gimp 图像编辑CLI 是做什么的?

一个基于 Pillow 的状态化命令行图像编辑界面。专为 AI 代理和高级用户设计,无需图形界面即可创建和操作图像。

安装

本 CLI 作为 cli-anything-gimp 包的一部分安装:

pip install cli-anything-gimp

前置条件:

  • Python 3.10+
  • 建议安装 GIMP 以支持原生批量渲染,但当 GIMP 不可用或存在延迟的 draw 操作时,分层合成仍可通过内置的 Pillow 路径进行渲染

使用说明

基本命令

# 显示帮助信息
cli-anything-gimp --help

# 启动交互式 REPL 模式
cli-anything-gimp

# 创建新项目
cli-anything-gimp project new -o project.json

# 以 JSON 输出运行(适用于代理消费)
cli-anything-gimp --json project info -p project.json

REPL 模式

当不携带子命令调用时,CLI 会进入交互式 REPL 会话:

cli-anything-gimp
# 交互式输入命令,支持 Tab 补全和历史记录

命令组

项目命令组

项目管理命令。

命令描述
new创建新项目
open打开已有项目
save保存当前项目
info显示项目信息
profiles列出可用的画布预设
json打印原始项目 JSON

图层命令组

图层管理命令。

命令描述
new创建新的空白图层
add-from-file从图像文件添加图层
list列出所有图层
remove按索引移除图层
duplicate复制图层
move将图层移动到新位置
set设置图层属性(名称、不透明度、可见性、混合模式、x偏移、y偏移);负偏移值自然支持
flatten拼合所有可见图层
merge-down将图层与下方的图层合并

画布命令组

画布操作。

命令描述
info显示画布信息
resize调整画布大小(不缩放内容)
scale按比例缩放画布及所有内容
crop裁剪画布到指定矩形区域
mode设置画布颜色模式
dpi设置画布 DPI

滤镜命令组

滤镜管理命令。

命令描述
list-available列出所有可用的滤镜
info显示滤镜详情
add为图层添加滤镜
remove按索引移除滤镜
set设置滤镜参数
list列出图层上的滤镜

媒体命令组

媒体文件操作。

命令描述
probe分析图像文件
list列出项目中引用的媒体文件
check检查所有引用的媒体文件是否存在
histogram显示图像的直方图分析

导出命令组

导出/渲染命令。

命令描述
presets列出导出预设
preset-info显示预设详情
render将项目渲染为图像文件;延迟的绘制操作在渲染时应用

会话命令组

会话管理命令。

命令描述
status显示会话状态
undo撤销上次操作
redo重做上次撤销的操作
history显示撤销历史

绘制命令组

绘制操作(在渲染时应用)。

命令描述
text在图层上绘制文字(将其转换为文字图层)
rect绘制矩形(存储为绘制操作)

示例

创建新项目

创建一个新的 GIMP 项目文件。

cli-anything-gimp project new -o myproject.json
# 或使用 JSON 输出以便程序化使用
cli-anything-gimp --json project new -o myproject.json

交互式 REPL 会话

启动一个支持撤销/重做的交互式会话。

cli-anything-gimp
# 交互式输入命令
# 使用 'help' 查看可用命令
# 使用 'undo' 和 'redo' 进行历史导航

导出项目

将项目导出为最终输出格式。

cli-anything-gimp --project myproject.json export render output.png --overwrite

分层合成工作流程

适用于叠加密集型合成:

cli-anything-gimp --project poster.gimp-cli.json layer set 0 offset_x -48
cli-anything-gimp --project poster.gimp-cli.json layer set 0 offset_y 24
cli-anything-gimp --project poster.gimp-cli.json draw text --layer 0 --text "Launch Night" --x 96 --y 120 --size 72 --color "#f6f1e8"
cli-anything-gimp --project poster.gimp-cli.json export render output.png --overwrite

注意事项:

  • layer set 命令现在同时在命令模式和 REPL 模式下接受负数值的 offset_x 和 offset_y。
  • draw text 和 draw rect 是渲染时操作。应将导出的图像(而不仅仅是项目 JSON)作为审查对象。
  • 对于包含延迟绘制操作的项目,即使安装了 GIMP,Pillow 渲染路径也将是稳定的默认选项。

状态管理

CLI 维护以下会话状态:

  • 撤销/重做:最多 50 级历史记录
  • 项目持久化:以 JSON 格式保存/加载项目状态
  • 会话跟踪:跟踪修改和变更

输出格式

所有命令支持双输出模式:

  • 人类可读(默认):表格、颜色、格式化文本
  • 机器可读(--json 标志):结构化 JSON,适用于代理消费
# 人类输出
cli-anything-gimp project info -p project.json

# 适用于代理的 JSON 输出
cli-anything-gimp --json project info -p project.json

针对 AI 代理

当以编程方式使用此 CLI 时:

  1. 始终使用 --json 标志 以获取可解析的输出
  2. 检查返回码 - 0 表示成功,非零表示错误
  3. 解析 stderr 以获取失败时的错误消息
  4. 为所有文件操作使用绝对路径
  5. 在导出操作后验证输出文件是否存在
  6. 在偏移、绘制、混合模式或滤镜更改后审查渲染输出,而不是仅信任已保存的项目状态

更多信息

  • 完整文档:请参阅包内的 README.md
  • 测试覆盖:请参阅包内的 TEST.md
  • 方法论:请参阅 cli-anything-plugin 中的 HARNESS.md

版本

1.0.0

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cli-anything-adguardhome

>-

cli-anything-anygen

>-

cli-anything-audacity

>-

cli-anything-blender

>-

cli-anything-browser

Browser automation CLI using DOMShell MCP server. Maps Chrome

cli-anything-calibre

>-

cli-anything-ccswitch

CLI interface for CC Switch — manage AI coding tool configurations from the terminal

cli-anything-chromadb

>-

cli-anything-cloudanalyzer

Command-line interface for CloudAnalyzer — Agent-friendly harness for CloudAnalyzer, a QA platform for mapping, localization, and perception outputs. Supports 27 commands across 8 groups: point cloud evaluation, trajectory evaluation, ground segmentation QA, config-driven quality gates, baseline evolution, processing, visualization, and interactive REPL.

cli-anything-cloudcompare

Command-line interface for CloudCompare — Agent-friendly harness for CloudCompare, the open-source 3D point cloud and mesh processing software. Supports 41 commands across 9 groups: project management, session control, point cloud operations (subsample, filter, segment, analyze), mesh operations, distance computation (C2C, C2M), transformations (ICP, matrix), export (LAS/LAZ/PLY/PCD/OBJ/STL/E57), and interactive REPL.

cli-anything-comfyui

>-

cli-anything-dify-workflow

Wrapper for the Dify workflow DSL CLI. Create, inspect, validate, edit, and export Dify workflow files through a CLI-Anything harness.

cli-anything-drawio

>-

cli-anything-eez-studio

Use EEZ Studio from the command line: inspect and modify native .eez-project files, edit LVGL screens/widgets, manage SCPI commands, and invoke the real EEZ Studio backend for LVGL builds.

cli-anything-eth2-quickstart

>-

cli-anything-exa

>-

cli-anything-firefly-iii

Firefly III CLI - Personal finance management via CLI-Anything

cli-anything-freecad

Complete CLI harness for FreeCAD parametric 3D CAD modeler (258 commands). Covers ALL workbenches: Part (29 primitives + boolean + mirror + loft + sweep), Sketcher (26 cmds: geometry + constraints + editing), PartDesign (38 cmds: pad/pocket/groove/fillet/chamfer/patterns/hole/datum), Assembly (11 cmds), Mesh (16 cmds), TechDraw (15 cmds: views + dimensions + PDF/SVG), Draft (33 cmds: 2D shapes + arrays + transforms), FEM (12 cmds), CAM/CNC (10 cmds), Surface (6 cmds), Spreadsheet (7 cmds), Import (13 formats), Export (17 formats), Measure (12 cmds), Materials (21 presets). Headless FreeCAD export to STEP/IGES/STL/OBJ/DXF/PDF/glTF/3MF.

cli-anything-godot

>-

cli-anything-inkscape

>-

相关技能