关于 image-filter-lab
image-filter-lab 是用于图像滤镜和效果处理的 Python 库及命令行工具,支持自定义预设和批量处理。
主要功能
- 01色彩与色调调整
- 02模糊和艺术效果
- 03保存并应用自定义预设
- 04批量处理图像
适用场景
- 01为照片应用复古效果
- 02通过命令行调整亮度和对比度
- 03用同一组滤镜处理多张图像
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ dkyazzentwatwa/ chatgpt-skills --skill image-filter-lab安装后在 Claude Code 中输入/image-filter-lab确认已加载。
附带文件scripts/image_filter.pyscripts/requirements.txt
详细介绍
图像滤镜实验室
为图像应用专业滤镜和特效。
功能
- 色彩滤镜:棕褐色、黑白、色彩着色、饱和度
- 模糊效果:高斯模糊、动态模糊、径向模糊
- 艺术滤镜:复古、胶片颗粒、暗角
- 增强效果:锐化、对比度、亮度
- 自定义预设:保存并应用滤镜组合
- 批量处理:为多张图像应用滤镜
快速入门
from image_filter import ImageFilterLab
lab = ImageFilterLab()
lab.load("photo.jpg")
# Apply vintage filter
lab.vintage()
lab.save("photo_vintage.jpg")
# Chain multiple effects
lab.load("photo.jpg")
lab.brightness(1.2).contrast(1.1).saturation(0.8).vignette()
lab.save("photo_edited.jpg")
CLI 用法
# Apply single filter
python image_filter.py --input photo.jpg --filter vintage --output result.jpg
# Apply multiple filters
python image_filter.py -i photo.jpg --sepia --vignette --sharpen -o result.jpg
# Adjust parameters
python image_filter.py -i photo.jpg --brightness 1.2 --contrast 1.1 -o result.jpg
# Batch process
python image_filter.py --batch photos/ --filter vintage --output-dir filtered/
API 参考
ImageFilterLab 类
class ImageFilterLab:
def __init__(self)
# Loading
def load(self, filepath: str) -> 'ImageFilterLab'
# Color Filters
def grayscale(self) -> 'ImageFilterLab'
def sepia(self, intensity: float = 1.0) -> 'ImageFilterLab'
def negative(self) -> 'ImageFilterLab'
def tint(self, color: Tuple, intensity: float = 0.3) -> 'ImageFilterLab'
# Adjustments
def brightness(self, factor: float) -> 'ImageFilterLab'
def contrast(self, factor: float) -> 'ImageFilterLab'
def saturation(self, factor: float) -> 'ImageFilterLab'
def hue(self, shift: int) -> 'ImageFilterLab'
def temperature(self, value: int) -> 'ImageFilterLab'
# Blur Effects
def blur(self, radius: int = 5) -> 'ImageFilterLab'
def motion_blur(self, size: int = 15, angle: int = 0) -> 'ImageFilterLab'
def radial_blur(self, amount: int = 10) -> 'ImageFilterLab'
# Sharpen
def sharpen(self, factor: float = 1.0) -> 'ImageFilterLab'
def unsharp_mask(self, radius: int = 2, percent: int = 150) -> 'ImageFilterLab'
# Artistic
def vintage(self) -> 'ImageFilterLab'
def film_grain(self, amount: int = 25) -> 'ImageFilterLab'
def vignette(self, radius: float = 0.8, intensity: float = 0.5) -> 'ImageFilterLab'
def posterize(self, levels: int = 4) -> 'ImageFilterLab'
def solarize(self, threshold: int = 128) -> 'ImageFilterLab'
# Presets
def apply_preset(self, preset: str) -> 'ImageFilterLab'
def save_preset(self, name: str, operations: List) -> None
# Output
def save(self, filepath: str, quality: int = 95) -> str
def reset(self) -> 'ImageFilterLab'
# Batch
def batch_process(self, input_dir: str, output_dir: str,
filter_func: callable) -> List[str]
内置预设
- vintage:棕褐色调、降低饱和度、暗角
- film:轻微降低饱和度、颗粒效果、压暗黑色
- instagram:高对比度、暖色调、暗角
- noir:高对比度黑白效果、强烈暗角
- warm:暖色温、提高饱和度
- cool:冷色温、略微降低饱和度
- dramatic:高对比度、深阴影
- dreamy:柔和模糊、明亮高光、低对比度
依赖项
- pillow>=10.0.0
- opencv-python>=4.8.0
- numpy>=1.24.0
评论
支持 Markdown