← 返回命令列表

Linux command

tinifier 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Compress all images in a directory

tinifier --api-key [KEY] [./images/]

Compress recursively with 4 threads

tinifier -t 4 -r --api-key [KEY] [./images/]

Compress preserving file modification time and EXIF data

tinifier --preserve-time --api-key [KEY] [photo.png]

Compress only specific file extensions

tinifier --api-key [KEY] --ext [png,webp] [./images/]

Skip files with less than 5% size reduction

tinifier --api-key [KEY] --skip-if-diff-less [5] [./images/]

Keep original files alongside compressed versions

tinifier --api-key [KEY] --keep-original-file [./images/]

说明

tinifier compresses images using the TinyPNG API with parallel processing. It supports PNG, JPEG, WebP, and AVIF files. Multiple API keys can be provided for automatic switching when quotas are exceeded. The tool can recursively scan directories and preserves original file metadata on request.

参数

-k, --api-key _KEY_
TinyPNG API key. Multiple keys separated by commas for automatic switching when quotas are exceeded.
-t, --threads _N_
Number of parallel threads (default: 16).
-r, --recursive
Search for files in listed directories recursively.
-e, --ext _EXTENSIONS_
File extensions to compress (default: png,jpeg,jpg,webp,avif).
-p, --preserve-time
Preserve the original file modification date/time including EXIF data.
--keep-original-file
Leave the original uncompressed file alongside the compressed one.
--skip-if-diff-less _N_
Skip files if compression saves less than N percent (default: 1).
--max-errors _N_
Maximum number of errors before stopping (default: 10, 0 to disable).
--retry-attempts _N_
Number of retry attempts for operations (default: 3).
--delay-between-retries _DURATION_
Delay between retry attempts (default: 1s).
-c, --config-file _PATH_
Path to a configuration file.

FAQ

What is the tinifier command used for?

tinifier compresses images using the TinyPNG API with parallel processing. It supports PNG, JPEG, WebP, and AVIF files. Multiple API keys can be provided for automatic switching when quotas are exceeded. The tool can recursively scan directories and preserves original file metadata on request.

How do I run a basic tinifier example?

Run `tinifier --api-key [KEY] [./images/]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -k, --api-key _KEY_ do in tinifier?

TinyPNG API key. Multiple keys separated by commas for automatic switching when quotas are exceeded.