Skip to main content

Try_一个主流图片压缩方案的自动化脚本(利用 tinify 实现666)

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密匙 一>(https://tinify.cn/developers)

Project details


Release history Release notifications | RSS feed

This version

1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

img_compress2-1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

img_compress2-1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file img_compress2-1.tar.gz.

File metadata

  • Download URL: img_compress2-1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.7

File hashes

Hashes for img_compress2-1.tar.gz
Algorithm Hash digest
SHA256 dc4ecd820eb897c45b1fdb6c7dd238aa195d28258d313cf5566cc60d59a560e6
MD5 2f45d67aec065cab1df9f176c0b0b1af
BLAKE2b-256 ebf25d12818a8a1d503129a744449e64e297c74482dcc090b8a2ff9dc542e55e

See more details on using hashes here.

File details

Details for the file img_compress2-1-py3-none-any.whl.

File metadata

  • Download URL: img_compress2-1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.7

File hashes

Hashes for img_compress2-1-py3-none-any.whl
Algorithm Hash digest
SHA256 a7034bcfa669ca3f393c85df7670299af9ca95277c2b511fdafd06c88079346a
MD5 2971a958e57de6c97c36605c15d651e7
BLAKE2b-256 95ed3def253ff7fa4e20bf070508dfc77ca18642fc57dbbafc419150f29d78d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page