Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Convert images to JPEG

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>")
Comment

PREVIOUS NEXT
Code Example
Python :: função map python 
Python :: removing value from list python 
Python :: python unicode point to utf8 string 
Python :: python list extend 
Python :: np where and 
Python :: dfs algorithm python 
Python :: How to swap elements in a list in Python detailed 
Python :: how to delete whole list in python 
Python :: comment all selected lines in python 
Python :: pandas df iloc 
Python :: python using shutil method 
Python :: python decorator class 
Python :: self object 
Python :: python string length 
Python :: __call__() python 
Python :: dataframe names pandas 
Python :: pack() tkinter 
Python :: “Python unittest Framework 
Python :: heroku procfile 
Python :: Python format() function uses. 
Python :: check if string has capital letter python 
Python :: how to count the iteration a list python 
Python :: python function pointer with multiple args 
Python :: Multiple page UI within same window UI PyQt 
Python :: how to print on same line python 
Python :: pandascheck if two columns match and populate new column 
Python :: while loop choosing numbers 
Python :: kali linux run python script anywhere 
Python :: How to know position on Kivy 
Python :: python [a]*b means [a,a,...b times] 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =