image-enhancement-suite by dkyazzentwatwa/chatgpt-skills
npx skills add https://github.com/dkyazzentwatwa/chatgpt-skills --skill image-enhancement-suite专业的图像处理工具包,无需 Photoshop 或类似软件即可处理常见的图像任务。以一致的高质量结果处理单张图像或整个文件夹。
from scripts.image_enhancer import ImageEnhancer
# 单张图像处理
enhancer = ImageEnhancer("photo.jpg")
enhancer.resize(width=800).sharpen(0.5).save("photo_enhanced.jpg")
# 批量处理
from scripts.image_enhancer import batch_process
batch_process(
input_dir="raw_photos/",
output_dir="processed/",
operations=[
("resize", {"width": 1200}),
("watermark", {"text": "© 2024"}),
("compress", {"quality": 85})
]
)
# 按宽度调整(保持宽高比)
enhancer.resize(width=800)
# 按高度调整(保持宽高比)
enhancer.resize(height=600)
# 精确尺寸(可能失真)
enhancer.resize(width=800, height=600, maintain_aspect=False)
# 适应边界
enhancer.resize(max_width=1200, max_height=800)
# 按百分比缩放
enhancer.resize(scale=0.5) # 50%
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 从中心裁剪到特定尺寸
enhancer.crop(width=800, height=600)
# 带位置的裁剪
enhancer.crop(width=800, height=600, position='top-left')
# 位置:'center', 'top-left', 'top-right', 'bottom-left', 'bottom-right'
# 裁剪到精确坐标(左,上,右,下)
enhancer.crop(box=(100, 100, 900, 700))
# 智能裁剪(内容感知)
enhancer.smart_crop(width=800, height=600)
# 文本水印
enhancer.watermark(
text="© 2024 Company",
position='bottom-right',
opacity=0.5,
font_size=24,
color='white'
)
# 图像水印
enhancer.watermark(
image="logo.png",
position='bottom-right',
opacity=0.3,
scale=0.2 # 主图像宽度的 20%
)
# 平铺水印
enhancer.watermark(
text="DRAFT",
tiled=True,
opacity=0.1,
rotation=45
)
# 单独调整(范围:-1.0 到 1.0,0 = 无变化)
enhancer.brightness(0.2) # +20% 亮度
enhancer.contrast(0.3) # +30% 对比度
enhancer.saturation(-0.2) # -20% 饱和度
enhancer.sharpen(0.5) # 锐化
# 组合调整
enhancer.adjust(
brightness=0.1,
contrast=0.2,
saturation=0.1,
sharpen=0.3
)
# 自动增强
enhancer.auto_enhance()
# 应用预设滤镜
enhancer.filter('grayscale')
enhancer.filter('sepia')
enhancer.filter('vintage')
enhancer.filter('blur')
enhancer.filter('sharpen')
enhancer.filter('edge_enhance')
enhancer.filter('emboss')
# 自定义模糊
enhancer.blur(radius=2)
# 高斯模糊
enhancer.gaussian_blur(radius=3)
# 转换为不同格式
enhancer.save("output.png") # 根据扩展名自动检测
enhancer.save("output.webp")
enhancer.save("output.jpg")
# 显式指定格式
enhancer.convert('PNG').save("output.png")
enhancer.convert('WEBP').save("output.webp")
# JPEG 质量 (1-100)
enhancer.compress(quality=85).save("compressed.jpg")
# WebP 质量
enhancer.save("output.webp", quality=80)
# PNG 优化
enhancer.optimize_png().save("optimized.png")
# 目标文件大小
enhancer.compress_to_size(max_kb=500).save("sized.jpg")
# 网络优化
enhancer.preset('web') # 最大 1200px,85 质量,WebP
# 社交媒体
enhancer.preset('instagram') # 1080x1080,优化
enhancer.preset('twitter') # 1200x675
enhancer.preset('facebook') # 1200x630
enhancer.preset('linkedin') # 1200x627
# 打印质量
enhancer.preset('print_4x6') # 1800x1200,300dpi
enhancer.preset('print_8x10') # 3000x2400,300dpi
# 缩略图
enhancer.preset('thumbnail') # 150x150,中心裁剪
enhancer.preset('preview') # 最大 400px,70 质量
from scripts.image_enhancer import batch_process
# 对所有图像应用相同操作
results = batch_process(
input_dir="photos/",
output_dir="processed/",
operations=[
("resize", {"width": 1200}),
("watermark", {"text": "© 2024", "position": "bottom-right"}),
("compress", {"quality": 85})
],
formats=['jpg', 'png'], # 仅处理这些格式
recursive=True # 包含子目录
)
print(f"已处理: {results['success']} 张图像")
print(f"失败: {results['failed']} 张图像")
batch_process(
input_dir="photos/",
output_dir="processed/",
operations=[("resize", {"width": 800})],
rename_pattern="{name}_web_{index:03d}"
)
# 输出:photo_web_001.jpg, photo_web_002.jpg, ...
from scripts.image_enhancer import generate_sizes
# 从一张图像创建多种尺寸
sizes = generate_sizes(
"hero.jpg",
output_dir="responsive/",
widths=[320, 640, 1024, 1920],
format='webp'
)
# 输出:hero_320.webp, hero_640.webp, 等。
from scripts.image_enhancer import generate_icons
# 从单张图像生成网站图标和应用图标
icons = generate_icons(
"logo.png",
output_dir="icons/",
sizes=[16, 32, 48, 64, 128, 256, 512]
)
# 读取 EXIF 数据
metadata = enhancer.get_metadata()
print(metadata['camera'])
print(metadata['date_taken'])
print(metadata['gps'])
# 剥离元数据(隐私)
enhancer.strip_metadata()
# 保留特定元数据
enhancer.strip_metadata(keep=['copyright', 'artist'])
# 单个文件
python image_enhancer.py input.jpg -o output.jpg --resize 800 --quality 85
# 批量处理
python image_enhancer.py photos/ -o processed/ --resize 1200 --watermark "© 2024"
# 应用预设
python image_enhancer.py photo.jpg --preset instagram
# 生成图标
python image_enhancer.py logo.png --icons icons/
| 格式 | 读取 | 写入 | 备注 |
|---|---|---|---|
| JPEG | 是 | 是 | 有损,最适合照片 |
| PNG | 是 | 是 | 无损,支持透明度 |
| WebP | 是 | 是 | 现代格式,压缩效果好 |
| GIF | 是 | 是 | 支持动画 |
| BMP | 是 | 是 | 未压缩 |
| TIFF | 是 | 是 | 高质量,文件大 |
| ICO | 是 | 是 | 图标格式 |
| HEIC | 是 | 否 | iPhone 照片(仅读取) |
from scripts.image_enhancer import ImageEnhancer, ImageError
try:
enhancer = ImageEnhancer("photo.jpg")
enhancer.resize(width=800).save("output.jpg")
except ImageError as e:
print(f"图像错误: {e}")
except FileNotFoundError:
print("未找到图像文件")
enhancer = ImageEnhancer("photo.jpg")
# 全局设置
enhancer.config.update({
'default_quality': 85,
'default_format': 'webp',
'preserve_metadata': False,
'color_profile': 'sRGB',
'dpi': 72
})
batch_process() 并设置 parallel=Truepillow>=10.0.0
opencv-python>=4.8.0
numpy>=1.24.0
每周安装次数
86
代码仓库
GitHub 星标数
39
首次出现
2026年1月24日
安全审计
安装于
opencode76
gemini-cli74
cursor71
codex69
github-copilot67
cline63
Professional image processing toolkit that handles common image tasks without requiring Photoshop or similar software. Process single images or entire folders with consistent, high-quality results.
from scripts.image_enhancer import ImageEnhancer
# Single image processing
enhancer = ImageEnhancer("photo.jpg")
enhancer.resize(width=800).sharpen(0.5).save("photo_enhanced.jpg")
# Batch processing
from scripts.image_enhancer import batch_process
batch_process(
input_dir="raw_photos/",
output_dir="processed/",
operations=[
("resize", {"width": 1200}),
("watermark", {"text": "© 2024"}),
("compress", {"quality": 85})
]
)
# By width (maintain aspect ratio)
enhancer.resize(width=800)
# By height (maintain aspect ratio)
enhancer.resize(height=600)
# Exact dimensions (may distort)
enhancer.resize(width=800, height=600, maintain_aspect=False)
# Fit within bounds
enhancer.resize(max_width=1200, max_height=800)
# Scale by percentage
enhancer.resize(scale=0.5) # 50%
# Crop to specific dimensions from center
enhancer.crop(width=800, height=600)
# Crop with position
enhancer.crop(width=800, height=600, position='top-left')
# Positions: 'center', 'top-left', 'top-right', 'bottom-left', 'bottom-right'
# Crop to exact coordinates (left, top, right, bottom)
enhancer.crop(box=(100, 100, 900, 700))
# Smart crop (content-aware)
enhancer.smart_crop(width=800, height=600)
# Text watermark
enhancer.watermark(
text="© 2024 Company",
position='bottom-right',
opacity=0.5,
font_size=24,
color='white'
)
# Image watermark
enhancer.watermark(
image="logo.png",
position='bottom-right',
opacity=0.3,
scale=0.2 # 20% of main image width
)
# Tiled watermark
enhancer.watermark(
text="DRAFT",
tiled=True,
opacity=0.1,
rotation=45
)
# Individual adjustments (range: -1.0 to 1.0, 0 = no change)
enhancer.brightness(0.2) # +20% brightness
enhancer.contrast(0.3) # +30% contrast
enhancer.saturation(-0.2) # -20% saturation
enhancer.sharpen(0.5) # Sharpen
# Combined adjustment
enhancer.adjust(
brightness=0.1,
contrast=0.2,
saturation=0.1,
sharpen=0.3
)
# Auto-enhance
enhancer.auto_enhance()
# Apply preset filters
enhancer.filter('grayscale')
enhancer.filter('sepia')
enhancer.filter('vintage')
enhancer.filter('blur')
enhancer.filter('sharpen')
enhancer.filter('edge_enhance')
enhancer.filter('emboss')
# Custom blur
enhancer.blur(radius=2)
# Gaussian blur
enhancer.gaussian_blur(radius=3)
# Convert to different format
enhancer.save("output.png") # Auto-detect from extension
enhancer.save("output.webp")
enhancer.save("output.jpg")
# Explicit format
enhancer.convert('PNG').save("output.png")
enhancer.convert('WEBP').save("output.webp")
# JPEG quality (1-100)
enhancer.compress(quality=85).save("compressed.jpg")
# WebP with quality
enhancer.save("output.webp", quality=80)
# PNG optimization
enhancer.optimize_png().save("optimized.png")
# Target file size
enhancer.compress_to_size(max_kb=500).save("sized.jpg")
# Web optimized
enhancer.preset('web') # 1200px max, 85 quality, WebP
# Social media
enhancer.preset('instagram') # 1080x1080, optimized
enhancer.preset('twitter') # 1200x675
enhancer.preset('facebook') # 1200x630
enhancer.preset('linkedin') # 1200x627
# Print quality
enhancer.preset('print_4x6') # 1800x1200, 300dpi
enhancer.preset('print_8x10') # 3000x2400, 300dpi
# Thumbnail
enhancer.preset('thumbnail') # 150x150, center crop
enhancer.preset('preview') # 400px max, 70 quality
from scripts.image_enhancer import batch_process
# Apply same operations to all images
results = batch_process(
input_dir="photos/",
output_dir="processed/",
operations=[
("resize", {"width": 1200}),
("watermark", {"text": "© 2024", "position": "bottom-right"}),
("compress", {"quality": 85})
],
formats=['jpg', 'png'], # Only process these formats
recursive=True # Include subdirectories
)
print(f"Processed: {results['success']} images")
print(f"Failed: {results['failed']} images")
batch_process(
input_dir="photos/",
output_dir="processed/",
operations=[("resize", {"width": 800})],
rename_pattern="{name}_web_{index:03d}"
)
# Output: photo_web_001.jpg, photo_web_002.jpg, ...
from scripts.image_enhancer import generate_sizes
# Create multiple sizes from one image
sizes = generate_sizes(
"hero.jpg",
output_dir="responsive/",
widths=[320, 640, 1024, 1920],
format='webp'
)
# Output: hero_320.webp, hero_640.webp, etc.
from scripts.image_enhancer import generate_icons
# Generate favicon and app icons from single image
icons = generate_icons(
"logo.png",
output_dir="icons/",
sizes=[16, 32, 48, 64, 128, 256, 512]
)
# Read EXIF data
metadata = enhancer.get_metadata()
print(metadata['camera'])
print(metadata['date_taken'])
print(metadata['gps'])
# Strip metadata (privacy)
enhancer.strip_metadata()
# Preserve specific metadata
enhancer.strip_metadata(keep=['copyright', 'artist'])
# Single file
python image_enhancer.py input.jpg -o output.jpg --resize 800 --quality 85
# Batch processing
python image_enhancer.py photos/ -o processed/ --resize 1200 --watermark "© 2024"
# Apply preset
python image_enhancer.py photo.jpg --preset instagram
# Generate icons
python image_enhancer.py logo.png --icons icons/
| Format | Read | Write | Notes |
|---|---|---|---|
| JPEG | Yes | Yes | Lossy, best for photos |
| PNG | Yes | Yes | Lossless, supports transparency |
| WebP | Yes | Yes | Modern format, good compression |
| GIF | Yes | Yes | Animation support |
| BMP | Yes | Yes | Uncompressed |
| TIFF | Yes | Yes | High quality, large files |
| ICO | Yes | Yes | Icon format |
| HEIC |
from scripts.image_enhancer import ImageEnhancer, ImageError
try:
enhancer = ImageEnhancer("photo.jpg")
enhancer.resize(width=800).save("output.jpg")
except ImageError as e:
print(f"Image error: {e}")
except FileNotFoundError:
print("Image file not found")
enhancer = ImageEnhancer("photo.jpg")
# Global settings
enhancer.config.update({
'default_quality': 85,
'default_format': 'webp',
'preserve_metadata': False,
'color_profile': 'sRGB',
'dpi': 72
})
batch_process() with parallel=Truepillow>=10.0.0
opencv-python>=4.8.0
numpy>=1.24.0
Weekly Installs
86
Repository
GitHub Stars
39
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode76
gemini-cli74
cursor71
codex69
github-copilot67
cline63
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
44,900 周安装
中国A股实时股票价格查询工具 - Python脚本,支持多股查询与默认指数
208 周安装
Kernel TypeScript SDK:浏览器自动化与Playwright远程执行开发工具
207 周安装
SwiftUI自适应布局指南:ViewThatFits、AnyLayout、Layout协议响应式设计
203 周安装
Excel财务模型自动化处理工具:零错误公式、标准格式与智能分析
205 周安装
Python日志记录最佳实践:Loguru配置、JSONL结构化日志与跨平台日志轮转指南
207 周安装
Vue 2 开发指南 - Options API、组件、Vuex、Vue Router 完整教程
207 周安装
| Yes |
| No |
| iPhone photos (read only) |