+4 votes
in Programming Languages by (40.7k points)
I want to convert a .webp image file into a .png file. Is there any Python library for this?

1 Answer

+1 vote
by (157k points)
edited by

You can use methods from the PIL package to convert an image from one format to another format.

Here is an example:

from PIL import Image

webpfile = "webpfilename.webp"
pngfile = "pngfilename.png"
im = Image.open(webpfile)
im.save(pngfile, format="png", lossless=True)


...