S
S
savichek2021-03-22 02:14:11
Images
savichek, 2021-03-22 02:14:11

How to convert to webp in different sizes?

Greetings! I'm going to remake all images in webp for an adaptive site and, in addition, make several size options for each image, because. when narrowing the width of the browser screen - the width of the image containers will decrease.
Studying the issue, I came to the conclusion that the most native way to convert to webp is cwebp in the terminal, as recommended by Google itself. For those who don't like the Windows terminal, there is a program with a graphical interface called WebPconv.
My question is the following - how to set the size of the image when converting, specifying only one parameter (width or height)? In the above methods, I only learned how to set the image size with only two parameters at once, which is completely inconvenient, because. you have to calculate the ratio of height to width, otherwise you get a stretched image.

I need to convert a lot of images into 4 sizes, knowing only the width, and let the height be proportional.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mikeyuri, 2021-03-22
@savichek

For cwebp, use 0 instead of height (or width) in the -resize option.


-resize width height
Resize the source to a rectangle with size width x height. If either (but not both) of the width or height parameters is 0, the value will be calculated preserving the aspect-ratio.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question