Skip to content

Instantly share code, notes, and snippets.

@bpgould
Created November 11, 2022 22:32
Show Gist options
  • Save bpgould/f5e4ea1593c94615ba8a4903539ab984 to your computer and use it in GitHub Desktop.
Save bpgould/f5e4ea1593c94615ba8a4903539ab984 to your computer and use it in GitHub Desktop.
convert webp images to png
'''
convert webp images to png
'''
from sys import argv
from PIL import Image
# requirements: `pip install pillow`
# example usage:
# python main.py input.webp output.png
IMAGE_WEBP = "input.webp"
IMAGE_PNG = "out.png"
if argv[1]:
IMAGE_WEBP = argv[1]
if argv[2]:
IMAGE_PNG = argv[2]
im = Image.open(IMAGE_WEBP)
im.save(IMAGE_PNG, format="png", lossless=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment