Professional Image Post-Processing Tool
Features
- - ✅ Auto-detect and install ImageMagick
- ✅ Multiple editing style presets
- ✅ Support for RAW/JPG/PNG/TIFF formats
- ✅ Batch processing support
- ✅ Custom preset saving
- ✅ Isolated intermediate file management
Editing Style Presets
| Style | Characteristics | Use Cases |
|---|
| INLINECODE0 | Low saturation, teal-orange tones, vignette, grain | Post-apocalyptic, sci-fi, cinematic |
| INLINECODE1 |
High brightness, low contrast, cyan-green tint | Japanese fresh style, daily records |
|
vintage | Warm tones, faded look, soft focus | Retro, nostalgic |
|
bw-high | Black & white, high contrast | Documentary, artistic |
|
custom | User-defined parameters | Personalized needs |
Usage
Single Image Processing
CODEBLOCK0
Batch Processing
CODEBLOCK1
Custom Presets
CODEBLOCK2
Workflow (Iterative Step-by-Step Editing)
Core Principles
- - Must use iterative step-by-step editing to ensure each step meets quality standards before proceeding, ultimately generating the final image from the original without compression loss.
- Do not increase contrast unless the style specifically calls for high contrast.
- Unless style dictates otherwise, preserve smooth tonal transitions and retain highlight and shadow details.
- When reviewing intermediate and final images with multimodal models, watch for artifacts like color banding, noise, or color patches caused by excessive parameter adjustments.
Detailed Steps
1. Initialization
- - Detect ImageMagick, prompt for installation if not found
- Analyze original image (resolution, format, color space)
- Create isolated working directory based on original filename (to avoid file conflicts between different images; append -001, -002... for duplicates):
workspace/image-editor-work/
├── {filename}/ # Directory named after original file
│ ├── temp/ # Intermediate processing files
│ │ ├── step01.jpg
│ │ ├── step02.jpg
│ │ └── params/ # Successful parameter records per step
│ │ ├── step01_params.txt
│ │ ├── step02_params.txt
│ │ └── ...
│ └── final/ # Final output
│ └── xxx_final.jpg
├── {filename2}/ # Separate directory for another image
└── ...
- - Example: When processing
IMG_20260329_111232.dng, create image-editor-work/IMG_20260329_111232/ directory
2. Iterative Step-by-Step Editing (Key Process)
Core Principle: Preserve original dynamic range and bit depth
For all images (whether RAW or other formats), each step must start from the original file, stacking previously verified parameters to avoid dynamic range and bit depth loss from intermediate JPGs.
Step A - Generate Intermediate JPG (For validation only, not part of editing chain)
Core Principle: Always start from original file
Each processing step starts from the original file, carrying all previously verified parameters + new parameters for the current step, generating an intermediate JPG for multimodal validation only.
- - Command format examples:
CODEBLOCK4
- - JPG quality must be highest: INLINECODE7
- Strictly prohibited:
-resize or -crop: Do not change original resolution unless user explicitly requests - Note: ImageMagick 7+ uses
magick command, no need for INLINECODE11
Important: Intermediate JPGs are for multimodal model validation only, never used as input for next step.
Step B - Multimodal Validation
- - Use multimodal model to review generated intermediate JPG
- Determine if editing goal for this step is achieved
- If goal NOT achieved:
- Analyze cause, adjust magick parameters
-
Restart from original file with all previously verified params + adjusted new params
-
Repeat this step until达标 (standard met)
- Write the
new magick parameters for this step to
temp/params/stepXX_params.txt
-
Continue from original file for next step with all verified params (including just recorded)
Key Memory:
- - Each step re-reads original file
- Parameters accumulate: Step N = original + param1 + param2 + ... + paramN
- Intermediate JPGs are view-only, next step still starts from original
3. Loop Execution
- - Repeat "Step A → Step B" process for next editing step
- Record parameters to corresponding
stepXX_params.txt after each step达标 - Continue until all editing steps complete
4. Generate Final Image (Critical Step)
Strictly prohibited: Use last intermediate JPG as final output.
Correct approach:
- 1. Read original image
- Read each step's parameter file
stepXX_params.txt in sequence - Build complete magick command chain, concatenating all parameters in editing order
- Generate final image from original in one pass:
CODEBLOCK5
Why do this?
- - Intermediate JPGs suffer JPEG compression loss from multiple saves
- Applying all parameters from original in one pass avoids layer-by-layer compression
- Final image has highest quality
5. Wrap-up & Delivery
File Saving:
- - Copy final image to
final/ directory - Optional: Clean up intermediate files or keep for review
- Record processing log
Deliver to User:
- 1. Final file path (must provide)
Editing complete! Final image saved to: {final_path}
- 2. Send image to user
Important: Regardless of open_result_view success, always explicitly inform user of local file path to ensure they can find the final product.
Workflow Diagram
Unified Processing Flow (all formats):
CODEBLOCK7
Key Points:
- - Each step starts from original file
- Parameters accumulate: Step N = original + param1 + param2 + ... + paramN
- Intermediate JPGs for validation only, never participate in next step processing
Directory Structure
CODEBLOCK8
Naming Conventions:
- - Working directory name: INLINECODE17
- Intermediate files: INLINECODE18
- Parameter files: INLINECODE19
- Final files: INLINECODE20
Notes
- - Processing RAW format requires ImageMagick with RAW decoding support
- High-resolution images take longer to process
- Recommend processing preview images first to confirm effects
Editing Step Quality Standards (Agent Guidelines)
Multimodal Check Points
When reviewing intermediate JPGs, watch for:
| Step Type | Check Points | Standard Met |
|---|
| Contrast Adjustment | Highlight/shadow details, overall clarity | Shadow details present, highlights not blown, image has depth |
| Color Toning |
Color temperature, saturation, color cast | Matches target style (e.g., teal-orange has cyan-blue shadows + warm yellow highlights) |
|
Vignette | Corner darkening degree, transition smoothness | Corners noticeably darker, edge-to-center transition smooth, not jarring |
|
Sharpening | Edge clarity, noise control | Subject edges clear, no obvious aliasing or noise increase |
|
Grain | Grain uniformity, natural feel | Film texture natural, doesn't destroy details, grain evenly distributed |
|
Destructive Editing | Color banding, noise, color patches from excessive parameters | Natural color transitions, no banding, no noise beyond added grain, no artifacts |
Parameter Adjustment Strategy
- - Insufficient effect: Increase parameter intensity (e.g., contrast from 15 to 25)
- Excessive effect: Decrease parameter intensity (e.g., vignette from 80% to 60%)
- Color cast: Adjust hue or change tint fill color
- Local issues: Consider if regional processing is needed
Important Reminders
- 1. Quality first: All intermediate JPGs must use INLINECODE21
- Preserve original: Strictly prohibited from overwriting or modifying original images
- Parameter recording: Write to parameter file immediately after step达标 to prevent loss
- Always start from original: Each step starts from original file, stacking all previously verified params
- Intermediate JPGs for validation only: Never use intermediate JPGs as input for next step
- Final generation: Apply all parameters from original in one pass to generate final image
专业图像后期处理工具
功能特性
- - ✅ 自动检测并安装ImageMagick
- ✅ 多种编辑风格预设
- ✅ 支持RAW/JPG/PNG/TIFF格式
- ✅ 批量处理支持
- ✅ 自定义预设保存
- ✅ 隔离的中间文件管理
编辑风格预设
| 风格 | 特点 | 适用场景 |
|---|
| apocalyptic | 低饱和度、青橙色调、暗角、颗粒感 | 末日废土、科幻、电影感 |
| japanese |
高亮度、低对比度、青绿色调 | 日系清新风格、日常记录 |
| vintage | 暖色调、褪色效果、柔焦 | 复古、怀旧 |
| bw-high | 黑白、高对比度 | 纪实、艺术 |
| custom | 用户自定义参数 | 个性化需求 |
使用方法
单张图像处理
python
from scripts.editor import ImageEditor
editor = ImageEditor()
result = editor.process(
input_path=photo.dng,
style=apocalyptic,
outputname=myphoto
)
批量处理
python
editor.batch_process(
input_dir=./photos,
style=japanese,
output_dir=./output
)
自定义预设
python
创建自定义预设
editor.create_preset(
name=my_style,
params={
brightness_contrast: -10x30,
modulate: 100,70,
tint: #3a5a4a,
gamma: 0.95,
sharpen: 0x1.2,
noise: 0.3,
vignette: True
}
)
工作流程(迭代式逐步编辑)
核心原则
- - 必须使用迭代式逐步编辑,确保每一步在进入下一步前达到质量标准,最终从原始文件生成最终图像,无压缩损失。
- 除非风格明确要求高对比度,否则不要增加对比度。
- 除非风格另有规定,否则保留平滑的色调过渡,保留高光和阴影细节。
- 使用多模态模型检查中间图像和最终图像时,注意因参数调整过度导致的色带、噪点或色块等伪影。
详细步骤
1. 初始化
- - 检测ImageMagick,如果未找到则提示安装
- 分析原始图像(分辨率、格式、色彩空间)
- 基于原始文件名创建隔离的工作目录(避免不同图像之间的文件冲突;重复时添加-001、-002...):
workspace/image-editor-work/
├── {filename}/ # 以原始文件命名的目录
│ ├── temp/ # 中间处理文件
│ │ ├── step01.jpg
│ │ ├── step02.jpg
│ │ └── params/ # 每一步成功的参数记录
│ │ ├── step01_params.txt
│ │ ├── step02_params.txt
│ │ └── ...
│ └── final/ # 最终输出
│ └── xxx_final.jpg
├── {filename2}/ # 另一张图像的独立目录
└── ...
- - 示例:处理 IMG20260329111232.dng 时,创建 image-editor-work/IMG20260329111232/ 目录
2. 迭代式逐步编辑(关键流程)
核心原则:保留原始动态范围和位深度
对于所有图像(无论是RAW还是其他格式),每一步都必须从原始文件开始,叠加之前已验证的参数,避免中间JPG导致的动态范围和位深度损失。
步骤A - 生成中间JPG(仅用于验证,不参与编辑链)
核心原则:始终从原始文件开始
每个处理步骤从原始文件开始,携带所有之前已验证的参数 + 当前步骤的新参数,生成中间JPG仅用于多模态验证。
bash
# 步骤1:从原始文件开始
magick original.dng -brightness-contrast -5x20 -quality 100 step01.jpg
# 步骤2:仍然从原始文件开始,叠加步骤1参数 + 新参数
magick original.dng -brightness-contrast -5x20 -modulate 110,80 -quality 100 step02.jpg
# 步骤3:继续从原始文件开始,叠加步骤1+2参数 + 新参数
magick original.dng -brightness-contrast -5x20 -modulate 110,80 -fill #3a5a6a -tint 15 -quality 100 step03.jpg
- - JPG质量必须最高:-quality 100
- 严格禁止:-resize 或 -crop:除非用户明确要求,否则不要改变原始分辨率
- 注意:ImageMagick 7+ 使用 magick 命令,无需 magick convert
重要:中间JPG仅用于多模态模型验证,绝不能作为下一步的输入。
步骤B - 多模态验证
- - 使用多模态模型检查生成的中间JPG
- 判断该步骤的编辑目标是否达成
- 如果目标未达成:
- 分析原因,调整magick参数
-
从原始文件重新开始,携带所有之前已验证的参数 + 调整后的新参数
-
重复此步骤直到达标
- 将该步骤的
新magick参数写入 temp/params/stepXX_params.txt
-
从原始文件继续进行下一步,携带所有已验证的参数(包括刚记录的)
关键记忆点:
- - 每一步都重新读取原始文件
- 参数累积:步骤N = 原始文件 + 参数1 + 参数2 + ... + 参数N
- 中间JPG仅供查看,下一步仍然从原始文件开始
3. 循环执行
- - 对下一个编辑步骤重复步骤A → 步骤B流程
- 每一步达标后,将参数记录到对应的 stepXX_params.txt
- 继续直到所有编辑步骤完成
4. 生成最终图像(关键步骤)
严格禁止:使用最后一张中间JPG作为最终输出。
正确方法:
- 1. 读取原始图像
- 按顺序读取每一步的参数文件 stepXX_params.txt
- 构建完整的magick命令链,按编辑顺序连接所有参数
- 从原始文件一次性生成最终图像:
bash
magick original.dng \
-brightness-contrast -5x20 \
-modulate 110,65 -fill #2a5a6a -tint 20 -gamma 0.95 \
-size 4096x3072 radial-gradient:black-white -compose multiply -composite \
-sharpen 0x1.5 \
-attenuate 0.5 +noise gaussian \
-quality 100 final_xxx.jpg
为什么要这样做?
- - 中间JPG因多次保存而遭受JPEG压缩损失
- 从原始文件一次性应用所有参数,避免了逐层压缩
- 最终图像具有最高质量
5. 收尾与交付
文件保存:
- - 将最终图像复制到 final/ 目录
- 可选:清理中间文件或保留供审查
- 记录处理日志
交付给用户:
- 1. 最终文件路径(必须提供)
编辑完成!最终图像已保存至:{final_path}
- 2. 将图像发送给用户
重要:无论 openresultview 是否成功,始终明确告知用户本地文件路径,确保他们能找到最终产品。
工作流程图
统一处理流程(所有格式):
原始文件
│
├──► 步骤1参数 ──► 生成中间JPG ──► [多模态检查] ──► 达标?
│ │
│ 否 ──► 调整参数 ──► 从原始文件重新生成
│ │
│ 是 ──► 记录参数到 step01_params.txt
│
├──► 步骤1+2参数 ──► 生成中间JPG ──► [多模态检查] ──► 达标?
│ │
│ 否 ──► 调整参数 ──► 从原始文件重新生成
│ │
│ 是 ──► 记录参数到 step02_params.txt
│
├──► 步骤1+2+3参数 ──► 生成中间JPG ──► [多模态检查] ──