Last active
November 15, 2021 14:55
-
-
Save pratik-choudhari/2895a3707075ac9b71a9066369981dff to your computer and use it in GitHub Desktop.
pythonji code to convert images in jpg
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
| import os as π₯οΈ | |
| import sys as π οΈ | |
| from PIL import Image as πΌοΈ | |
| for π₯ in π οΈ.argv[2:]: | |
| f, e = π₯οΈ.path.splitext(π₯) | |
| π€ = f + ".jpg" | |
| if π₯ != π€: | |
| try: | |
| with πΌοΈ.open(π₯) as π¦: | |
| π¦.save(π€) | |
| except OSError as β: | |
| print("cannot convert", π₯, "error => ", str(β)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment