一个主流图片压缩方案的自动化脚本(利用 tinify 实现)
Project description
一个主流图片压缩方案的自动化脚本(利用 tinify 实现)
实现三种图片输入的方式
- 用户可以指定需要压缩的图片文件名称(支持多个图片文件,使用空格隔开)
- 如果用户未指定图片,默认压缩当前文件夹下所有的 jpg/jpeg/png/webp 图片
支持图片的尺寸调整
- 输入宽度和高度(比如 600 800),表示按比例缩小图片,使其适合给定的尺寸
- 输入宽度(比如 600 0),表示按确定的宽度调整图片,高度适配
- 输入高度(比如 0 800),表示按确定的高度调整图片,宽度适配
- 如未输入宽度和高度,则表示按照原始分辨率来压缩图片
调用方法
import img_compress
img_compress.tinify.key = "" # 请在https://tinify.cn/developers申请密匙
img_compress.compress() # 可以指定多个图片文件,未指定则压缩当前路径下的图片
注意:需先到tifiny官网申请API密匙 -> 传送门
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
imgm_compress-0.0.3.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imgm_compress-0.0.3.tar.gz.
File metadata
- Download URL: imgm_compress-0.0.3.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abfcf228971ce1036ae2623e2f15be9eef7cadfe2034c5e0721cd2f07b18a17f
|
|
| MD5 |
3c027834ba246ce5e7c0f72e355295b1
|
|
| BLAKE2b-256 |
f6b40fe1c48e6bd015f350102421e8dbfe17c0043fdb0dfe39697f21efb3cee8
|
File details
Details for the file imgm_compress-0.0.3-py3-none-any.whl.
File metadata
- Download URL: imgm_compress-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8389b4d43a86e13f3daf3243dbe6e1609b6bb5bc2f40b062b544b0c9a0cd5e43
|
|
| MD5 |
c65f4db94a7c7eb2dfaaa51d98fca0a3
|
|
| BLAKE2b-256 |
3a7fc57e8bb33048e0b750ac1af2b23fb1963651766a5a7d60af85f3248029d0
|