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.
- WebP
- SVG
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.
- Follow this guide to allow Termux to access your phone's storage
- Run
apt update
andapt upgrade
to make sure the list of installable apps and installed apps are up to date. - Run
apt install imagemagick
- Linux Terminal tips: use
ls
to view the contents of the current directory. Subdirectories will usually be in color. Usepwd
to show the current directory. Usecd directoryname
to navigate to a different directory. Usecd ..
to back out of the current directory. Use justcd
to return to the home directory. - You can use the webp2common script on Android.
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.