# CLI Anything Photoshop

通过 COM 自动化操控 Adobe Photoshop 的 CLI harness。支持项目管理、图层操作、选区控制、文字编辑、图像调整和多格式导出。

- Repository: https://github.com/yb2460/harness-anything (2787 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-10-09
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add yb2460/harness-anything --skill cli-anything-photoshop -g -a claude-code -y`
Codex: `npx skills add yb2460/harness-anything --skill cli-anything-photoshop -g -a codex -y`
Cursor: `npx skills add yb2460/harness-anything --skill cli-anything-photoshop -g -a cursor -y`
Gemini CLI: `npx skills add yb2460/harness-anything --skill cli-anything-photoshop -g -a gemini-cli -y`

## Description

通过 COM 自动化操控 Adobe Photoshop 的 CLI harness。支持项目管理、图层操作、选区控制、文字编辑、图像调整和多格式导出。

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# CLI-Anything Photoshop

通过 Windows COM 自动化接口操控 Adobe Photoshop 的命令行工具。

## 前置条件

- **Windows 10/11**
- **Adobe Photoshop 2023+** (需注册 COM 接口)
- **Python 3.10+** 及 `pywin32` 包

## 安装

```bash
cd photoshop-harness/agent-harness
pip install -e .
```

安装后可使用 `cli-anything-photoshop` 命令。

## 命令结构

```
cli-anything-photoshop [--json] [--project <path>] [--dry-run] <command-group> <command> [options]
```

### 全局选项

| 选项 | 描述 |
|------|------|
| `--json` | 以 JSON 格式输出（供 AI Agent 解析） |
| `--project <path>` | 自动打开或创建 PSD 项目文件 |
| `--dry-run` | 执行命令但不保存到磁盘 |

## 命令组

### project, 项目管理
| 命令 | 选项 | 描述 |
|------|------|------|
| `new <path>` | `-w` width, `-h` height, `-r` resolution, `-m` mode, `-b` bg-color | 创建新 PSD |
| `open <path>` | | 打开 PSD 文件 |
| `save [path]` | | 保存文档 |
| `close` | `--no-save` | 关闭文档 |

### document, 文档操作
| 命令 | 选项 | 描述 |
|------|------|------|
| `info` | | 文档信息 |
| `resize` | `-w` width, `-h` height, `-r` resolution | 调整尺寸 |
| `canvas` | `-w` width, `-h` height, `-a` anchor | 调整画布 |
| `crop` | `--left --top --right --bottom` | 裁切 |
| `rotate` | `-a` angle | 旋转画布 |
| `flip` | `-d` direction | 翻转画布 |
| `mode` | `-m` mode | 更改色彩模式 |
| `trim` | `-t` type | 裁切边缘 |

### layer, 图层操作
| 命令 | 选项 | 描述 |
|------|------|------|
| `add` | `-n` name, `-t` type, `-o` opacity, `-b` blend | 添加图层 |
| `delete` | `-n` name | 删除图层 |
| `duplicate` | `-n` name, `--new-name` name | 复制图层 |
| `rename` | `--old` name, `--new` name | 重命名 |
| `show` / `hide` | `-n` name | 显示/隐藏 |
| `opacity` | `-n` name, `-o` opacity | 设置透明度 |
| `blend` | `-n` name, `-m` mode | 设置混合模式 |
| `list` | | 列出所有图层 |
| `reorder` | `-n` name, `-p` position | 调整顺序 |
| `merge` | `-n` name, `--with-layer` name | 合并图层 |

The rest: https://github.com/yb2460/harness-anything/blob/HEAD/photoshop-harness/skills/cli-anything-photoshop/SKILL.md
