How to rotate webp images on Mac

Recently, due to a change in work, I switched to the Mac environment and encountered the problem that when using the cwebp command to convert a JPG image to webp, the image was rotated 90 degrees counterclockwise.

For example, I selected a dozen pictures of Jiuzhaigou travel from the Photos software. Use a script to batch convert to webp format (webp format is small and can ensure fast loading for readers. A JPG of several megabytes will be very stuck). Generally, I select about 14 pictures. At this time, you will find that the original normal pictures will be Rotate 90 degrees as shown below:

webp rotate

What’s even more outrageous about the above picture is that some are rotated 90 degrees, and some are rotated 180 degrees. I have never encountered such a problem when using cwebp on Linux before. I don’t know if it has something to do with the image source. I will test it again when I have the opportunity.

At this point, we can't find Apple or the glass man Captain Cook, and we have no way to find the maintainer of cwebp for the time being. We can only find a way to solve it ourselves.

First, think of using Mac’s image preview rotation:

Preview webp

It does not support Webp format image rotation, which is really weak 🤷‍♂️🤷‍♀️.

Next, search online and use the sips command

1mephisto@RMBP ~/g/m/s/i/t/jiuzhaigou (main)> sips -r 90 IMG_3655.webp
2/Users/mephisto/github/mephisto.cc/static/images/travel/jiuzhaigou/IMG_3655.webp
3Error: Unsupported output format org.webmproject.webp
4   /Users/mephisto/github/mephisto.cc/static/images/travel/jiuzhaigou/IMG_3655.webp
5Error 13: an unknown error occurred
6Try 'sips --help' for help using this tool

The image format is not supported! ! !

The only option was to use a killer tool. As a Linux user of N years, I thought of GIMP. So far, I have not encountered an image that GIMP cannot handle. You can always trust GIMP.

1. Select N multiple pictures

After selecting N pictures, drag them directly into GIMP. If you don’t have enough memory, drag less, otherwise it will be troublesome if they get stuck.

multi-edit

2. Rotate pictures

Start rotating the pictures one by one. After all, the current angle of each picture is different and needs to be processed one by one.

gimp-webp-rotate

There are various common preset rotation angles in the submenu, and you can also choose the angle at will. It can be said that it is simple and easy to use.

3. Save changes

After rotating the angle, of course you need to save the changes.

The most direct way to save is, as shown in the figure below, Overwrite, which directly overwrites the original file.

save-rotate

After the progress is completed, just turn off GIMP or turn off opening pictures.

Of course, when operating too many pictures in this way, it has to be said that the efficiency is really not high. Although the method is stupid, it can be used as a comprehensive non-programming solution to meet the rotation needs of most ordinary users.

However, who would have thought that cwebp can batch modify pictures and rotate them at different angles? Next time I will take the same picture and test it under Linux.

The advantage of using GIMP is that it costs nothing, has powerful functions, and can handle almost any image format. What else is not satisfying?

Lastmod: Friday, April 12, 2024

Translations: