# pytool **Repository Path**: mirahs/pytool ## Basic Information - **Project Name**: pytool - **Description**: 使用 python 开发的相关工具 - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-05-24 - **Last Updated**: 2024-05-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # pytool 使用`python`开发的相关工具 ## 开发语言 `python`参考 [python安装](https://mp.weixin.qq.com/s/aknR6jjW45K7I33bBuRA-Q) ## 安装依赖 ```powershell pip install -r requirements.txt ``` ## 切图工具 图片按照指定大小切成小图 ```powershell D:\pytool>python main.py image clip --help Usage: main.py image clip [OPTIONS] 切图 Options: -f, --file PATH 图片源文件 [required] -s, --size [256|512] 切图大小 [default: 512] -o, --out TEXT 切图输出目录 --origin [top|bottom] 原点(top 左上角 | bottom 左下角) [default: bottom] --help Show this message and exit. ``` 比如下面会把`1103.jpg`这张图片从左下角开始按照`512x512`大小切成一定数量的小图存放在`1103/`目录下面,并会额外生成一个记录了原始图片相关信息的`1103/slices.json`文件。 ```powershell python main.py image clip -f 1103.jpg ``` ## 缩略图工具 图片按照指定大小生成缩略图 ```powershell D:\pytool>python main.py image thumb --help Usage: main.py image thumb [OPTIONS] 缩略图 Options: -f, --file PATH 图片源文件 [required] -s, --size [256|512] 缩略图大小 [default: 256] -o, --out TEXT 缩略图输出目录 --help Show this message and exit. ``` 比如下面会生成`1103.jpg`这张图片的缩略图文件`1103/min.jpg`。 ```powershell python main.py image thumb -f 1103.jpg ```