高效图片工厂:Python批量生成定制尺寸和格式的图片
做一个图片处理工具系统中,我们有时会需要快速生成指定尺寸和不同格式的图片用来测试兼容性,方便在页面交互做些更好的提示。虽然现在有不是AI生图工具,找了好几个也没合适的可以直接满足这种需求,最后还是用脚本批量处理了。
from PIL import Image, ImageDraw, ImageFont
import os
from datetime import datetimedef create_timestamped_images(format_list, output_dir, width=800, height=600):