Files
imgwatermark/.workbuddy/memory/2026-09-18.md
T

30 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 2026-09-18 工作日志
## 完成事项
- 初始化 imgwatermark 图像水印 CLI 工具项目
- 实现基本水印功能:右下角半透明背景 + 白色文字水印
- 支持格式转换:输入图片加水印后可转为指定格式输出(jpg/png/bmp/gif/tiff/webp)
- 修复路径引号处理问题(支持带引号的路径传入)
- 优化启动帮助菜单样式,参考 vipsong 项目布局
- 移除 /help 命令(启动时已显示完整帮助)
- 统计功能:/get 查询累计处理图片数量
- 项目已推送到 https://git.ypshidifu.cn/youpaishidifu/imgwatermark.git (main)
## 后续修复(22:07-22:45)
- 修复水印不可见问题:透明度从100提升到180,颜色改为深色rgba(30,30,30,180)
- 修复路径解析bug:新增对 `./目录/.格式` 语法的支持(如 `./1/.bmp` -> 输出到 ./1/ 目录,格式为 bmp)
- 补充 README.md 文档
## 关键文件
- main.py - CLI 入口,命令解析
- watermark.py - 核心水印逻辑
- config.py - 配置常量
- requirements.txt - 依赖声明
- .gitignore - Git 忽略规则
## 技术要点
- 使用 Pillow (PIL) 进行图像处理
- 水印图层:RGBA 透明层 + alpha_composite 合成
- 字体自动检测:优先使用微软雅黑,回退到黑体/宋体/Arial
- 输出路径:output/ 目录 + 原文件名_watermarked.ext