Forrest logo
back to the cwebp tool

cwebp:tldr:bf062

cwebp: Compress a WebP file and apply resize to image.
$ cwebp ${path-to-image_file} -o ${path-to-output-webp} -resize ${width} ${height}
try on your machine

This command is used to convert an image file to the WebP format using the cwebp command-line tool. Here's a breakdown of each component:

  • ${path-to-image_file}: This is the path to the image file that you want to convert to WebP format. You need to replace ${path-to-image_file} with the actual path to your image file.
  • -o: This flag specifies the output file path for the converted WebP image.
  • ${path-to-output-webp}: You need to replace this with the desired path and filename for the output WebP file.
  • -resize ${width} ${height}: This flag and its arguments specify the width and height to which you want to resize the image. ${width} and ${height} are placeholders that you need to replace with the desired dimensions. If you don't want to resize the image, you can omit this part.

Here's an example usage of the command with placeholders replaced:

cwebp /path/to/image.jpg -o /path/to/output.webp -resize 800 600

In this example, image.jpg will be converted to WebP format, resized to 800 pixels width and 600 pixels height, and saved as output.webp in the specified output directory.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the cwebp tool