feat(fx): 添加像素排序 (Pixel Sort) 滤镜 #67

Merged
Passthem merged 2 commits from pi-agent/konabot:feature/pixel-sort into master 2026-04-08 15:52:03 +08:00
Contributor

功能说明

为 konabot 的 fx 指令新增 '像素排序' 滤镜,实现类似 Photoshop/GIMP Pixel Sort 效果。

功能特性

  • 排序方向: 支持水平 (horizontal) 和垂直 (vertical) 方向排序
  • 排序依据: 支持按亮度 (brightness)、色相 (hue)、红/绿/蓝通道排序
  • 自动阈值: 支持使用图像亮度中位数自动计算遮罩阈值
  • 自定义阈值: 支持手动设置遮罩阈值 (mask_threshold)
  • 反向排序: 支持从亮到暗排序
  • 块大小: 支持按块处理,每 N 行/列作为一个整体排序单位

使用示例

```
fx 图片 像素排序
fx 图片 像素排序 horizontal
fx 图片 像素排序 vertical hue true 128
fx 图片 像素排序 horizontal brightness false 64
```

参数说明

参数 类型 默认值 说明
direction str "horizontal" 排序方向
threshold float 0.0 亮度阈值(仅在 auto_threshold=False 时生效)
auto_threshold bool True 是否自动计算阈值
sort_by str "brightness" 排序依据
mask_threshold float 128.0 遮罩阈值
reverse bool False 是否反向排序
block_size int 1 块大小

相关文件

  • konabot/plugins/fx_process/fx_handle.py: 实现 Pixel Sort 算法
  • konabot/plugins/fx_process/fx_manager.py: 注册滤镜
  • tests/test_fx_process.py: 单元测试
  • konabot/docs/user/fx.txt: man 文档
## 功能说明 为 konabot 的 fx 指令新增 '像素排序' 滤镜,实现类似 Photoshop/GIMP Pixel Sort 效果。 ### 功能特性 - **排序方向**: 支持水平 (horizontal) 和垂直 (vertical) 方向排序 - **排序依据**: 支持按亮度 (brightness)、色相 (hue)、红/绿/蓝通道排序 - **自动阈值**: 支持使用图像亮度中位数自动计算遮罩阈值 - **自定义阈值**: 支持手动设置遮罩阈值 (mask_threshold) - **反向排序**: 支持从亮到暗排序 - **块大小**: 支持按块处理,每 N 行/列作为一个整体排序单位 ### 使用示例 \`\`\` fx 图片 像素排序 fx 图片 像素排序 horizontal fx 图片 像素排序 vertical hue true 128 fx 图片 像素排序 horizontal brightness false 64 \`\`\` ### 参数说明 | 参数 | 类型 | 默认值 | 说明 | |------|------|--------|------| | direction | str | "horizontal" | 排序方向 | | threshold | float | 0.0 | 亮度阈值(仅在 auto_threshold=False 时生效)| | auto_threshold | bool | True | 是否自动计算阈值 | | sort_by | str | "brightness" | 排序依据 | | mask_threshold | float | 128.0 | 遮罩阈值 | | reverse | bool | False | 是否反向排序 | | block_size | int | 1 | 块大小 | ### 相关文件 - `konabot/plugins/fx_process/fx_handle.py`: 实现 Pixel Sort 算法 - `konabot/plugins/fx_process/fx_manager.py`: 注册滤镜 - `tests/test_fx_process.py`: 单元测试 - `konabot/docs/user/fx.txt`: man 文档
pi-agent added 1 commit 2026-04-08 14:21:57 +08:00
- 新增 '像素排序' 滤镜,实现类似 Photoshop Pixel Sort 效果
- 支持水平/垂直方向排序
- 支持多种排序依据:亮度、色相、红/绿/蓝通道
- 支持自动阈值计算(使用图像亮度中位数)
- 支持自定义遮罩阈值
- 支持反向排序
- 支持块大小参数
- 添加相关单元测试
pi-agent added 1 commit 2026-04-08 15:50:35 +08:00
Passthem merged commit e0268ec86b into master 2026-04-08 15:52:03 +08:00
Sign in to join this conversation.
No description provided.