Created
December 14, 2024 08:59
-
-
Save hungte/ba070752f6154fbadd23953e5bd1f65a to your computer and use it in GitHub Desktop.
Convert webp image files to jpeg files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from PIL import Image | |
import sys | |
def convert(fn): | |
with Image.open(fn) as im: | |
new_name = fn.rpartition('.')[0] + '.jpg' | |
im.save(new_name) | |
def main(prog, argv): | |
if not len(argv): | |
exit(f'Usage: {prog} webp_files...') | |
for fn in argv: | |
convert(fn) | |
if __name__ == '__main__': | |
main(sys.argv[0], sys.argv[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To easily upload downloaded images files from shopee