Thysbelon.Logo of a Hummingbird moth.

How to Convert from WebP or SVG to Formats like PNG and GIF

Online Converters:

WebpSvg2common. This is a webapp that I created on August 16th 2024. It supports WebP (both static and animated) and SVG. The rest of the post has been left for those interested, but my webapp WebpSvg2common is now my most recommended way to convert WebP and SVG to PNG and GIF.

The best adblocking extension is uBlock Origin. To install extensions on Android, use either Firefox or Kiwi Browser.

Offline Converters:

Just use ImageMagick. It's a command-line tool, but converting is easy.

The easiest way is to run this webp2common script in the same folder as the WebPs you want to convert (after installing imagemagick)

When installing ImageMagick on Windows, make sure you leave "add to system path" checked ✔. This allows you to use the program without needing to type the full file explorer path to ImageMagick every time (and it allows the webp2common script to function)

I will also tell you how to use ImageMagick on its own. On Windows, you can open a terminal by navigating to the folder your WebPs are stored in using File Explorer, then shift + right-click on an empty spot, then click "Open in PowerShell" or "Open in Command Prompt".

To convert a single image: magick input.webp output.png or convert input.webp output.png

To convert all webp images in the directory to png:
mogrify -format png *.webp

On Windows: magick mogrify -format png *.webp

Do note that animated WebPs converted to png will be output as many still png images, not an animated png. To convert animated webps to an animated image format, use apng or gif. Before converting to apng, check your version with magick -version, any below 7.1.10-20 will incorrectly speed up or slow down the output; the only workaround is to fiddle with the -delay option for each animated image. In order to batch convert many webp images to png for static images and gif for animated images, please use the webp2common script.

How to Convert SVGs

To convert all SVG images to png with transparent backgrounds:
mogrify -background none -format png *.svg (errors may appear even if the program works correctly). Remember that on Windows you need to add "magick" to the start of the command.

The quality of svg to png conversions can be improved by adding -density 400 to the command (after "mogrify"). Play around with the amount of density until you are happy with the result.

How to Use ImageMagick on Android

ImageMagick can be used on Android via Termux.

Miscellaneous Tips

Some Linux distributions only have ImageMagick-6 in their package repository. If you are using ImageMagick-6, svg conversions will have incorrect black strokes. This issue can be fixed by installing inkscape.

Tags:
Categories: