WebP conversion tool

WebP installation

Github:https://github.com/webmproject/WebPShop

Chinese tutorial: https://developers.google.com/speed/webp/docs/webpshop?hl=zh-cn

Recommended quick installation method:

https://formulae.brew.sh/formula/webp

Install directly with the command:

brew install webp

cwebp encoding (conversion to WebP)

cwebpTo convert images to WebP format, you can use the command line tool provided by Google . Here are cwebpthe steps to use the tool for image conversion:

  1. Install WebP Tools: First, you need to install the WebP Toolkit. You can download precompiled binaries for your OS from the official WebP site ( https://developers.google.com/speed/webp/docs/precompiled ), or install using a package manager (e.g. on Ubuntu Install using apt-getthe command).

  2. Open Terminal (Command Line Interface): Opens a terminal or command prompt so you can execute commands.

  3. Run the conversion command: Use the following command to convert the image to WebP format:

    cwebp [input_image] -o [output_image.webp]
    

    where [input_image]is the path and filename of the input image file you want to convert and [output_image.webp]is the path and filename of the output WebP file.

    For example, if you want to input.pngconvert a PNG image named WebP to output.webpa WebP image, you can run the following command:

    cwebp input.png -o output.webp
    

    This will generate output.webpa WebP image file named .

  4. Adjust conversion options (optional): There are cwebpother options you can use to adjust the parameters of the conversion process. For example, you can specify compression quality, resize images, and more. For more options, run the following command to view the help documentation:

    cwebp --help
    

    This will display cwebpthe help information for the command with the various options available and their descriptions.

  5. Result
    insert image description here
    Nothing is set, the compression is very small

dwebp decode

To decode, use the dwebp command.

insert image description here

Specify size:

Please add a picture description

More parameter configuration

https://www.jianshu.com/p/61ab330a6de6

Android Studio Encoding WebP

1、Convert to WebP…

insert image description here

2. Options

insert image description here

  • Quality changed from lossy 0 (image downgraded to fit in less bytes) to lossless 100 (pixels remain the same). Compressed size usually increases with quality, but for some images (such as screenshots, solid colors, etc.), the lossless algorithm produces smaller files.

  • The compression operation controls the encoding speed. Slowing it down increases visual quality and/or reduces file size.

  • The preview function will show the compressed picture and its final size. If the photo is too tall or too wide, a movable zoom-in area will appear. WARNING: For large images and/or heavy compression jobs, the GUI may become slow/unresponsive with this feature enabled.

  • For animations (multiple layers with a duration in the name, such as "Frame1 (123 ms)"), the slider selects the current frame and shows its preview and duration.

3. Compression

After compression, some pictures cannot be compressed, just like this prompt:

0 files were converted 3 files were skipped because there was no net space saving

0 files were converted, 3 files were skipped because there was no net space saved

4. Just run it directly

Guess you like

Origin blog.csdn.net/weixin_35691921/article/details/126730382