mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-01-18 07:17:03 +00:00
Create convert2jpg.py
This commit is contained in:
parent
4eda20bccd
commit
e37961483b
23
scripts/Convert-to-jpg/convert2jpg.py
Normal file
23
scripts/Convert-to-jpg/convert2jpg.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import os
|
||||
import sys
|
||||
from PIL import Image
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
if os.path.exists(sys.argv[1]):
|
||||
im = Image.open(sys.argv[1])
|
||||
target_name = sys.argv[1] + ".jpg"
|
||||
rgb_im = im.convert('RGB')
|
||||
rgb_im.save(target_name)
|
||||
print("Saved as " + target_name)
|
||||
else:
|
||||
print(sys.argv[1] + " not found")
|
||||
else:
|
||||
print("Usage: convert2jpg.py <file>")
|
||||
|
||||
|
||||
"""
|
||||
To run it use:
|
||||
|
||||
convert2jpg test.png
|
||||
|
||||
"""
|
Loading…
Reference in New Issue
Block a user