← 返回命令列表

Linux command

cavif 命令

文本

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

常用示例

Convert an image to AVIF format

cavif [path/to/image.png]

Convert with specific quality (1-100)

cavif --quality [80] [path/to/image.jpg]

Convert with faster encoding speed (1-10)

cavif --speed [6] [path/to/image.png]

Convert and specify output path

cavif -o [path/to/output.avif] [path/to/image.png]

Convert multiple images to a directory

cavif -o [path/to/output_dir/] [image1.png] [image2.jpg]

Overwrite existing AVIF files

cavif --overwrite [path/to/image.png]

说明

cavif is a command-line tool written in Rust for converting PNG and JPEG images to AVIF (AV1 Image File Format). AVIF uses AV1 video codec compression, offering superior compression ratios compared to JPEG while maintaining image quality. By default, output files are saved with the same name but with an .avif extension. Existing files are not overwritten unless --overwrite is specified.

参数

--quality _1-100_
Output quality level. Higher values mean better quality and larger files. Default: 80
--speed _1-10_
Encoding speed. 1 is slowest with best compression, 10 is fastest but lower quality. Default: 4
-o _path_
Output path. For multiple inputs, treated as a directory
--overwrite
Replace existing .avif files instead of skipping them
--quiet
Suppress output during conversion
--dirty-alpha
Preserve RGB values of fully transparent pixels (increases file size)
--color=rgb
Encode in RGB color space instead of YCbCr. Avoids color shifts but produces larger files
--depth=_8_
Encode using 8-bit color depth instead of default 10-bit for wider compatibility

FAQ

What is the cavif command used for?

cavif is a command-line tool written in Rust for converting PNG and JPEG images to AVIF (AV1 Image File Format). AVIF uses AV1 video codec compression, offering superior compression ratios compared to JPEG while maintaining image quality. By default, output files are saved with the same name but with an .avif extension. Existing files are not overwritten unless --overwrite is specified.

How do I run a basic cavif example?

Run `cavif [path/to/image.png]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --quality _1-100_ do in cavif?

Output quality level. Higher values mean better quality and larger files. Default: 80