Horje
convert files from jpg to png and save in a new directory python Code Example
convert files from jpg to png and save in a new directory python
from PIL import Image
import os

directory = r'D:\PATH'
c=1
for filename in os.listdir(directory):
    if filename.endswith(".jpg"):
        im = Image.open(filename)
        name='img'+str(c)+'.png'
        rgb_im = im.convert('RGB')
        rgb_im.save(name)
        c+=1
        print(os.path.join(directory, filename))
        continue
    else:
        continue




Python

Related
make each element in a list occur once python Code Example make each element in a list occur once python Code Example
save np array as mat file Code Example save np array as mat file Code Example
pandas get value not equal to Code Example pandas get value not equal to Code Example
calculator in one line in python Code Example calculator in one line in python Code Example
type object 'datetime.datetime' has no attribute 'timedelta' Code Example type object 'datetime.datetime' has no attribute 'timedelta' Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7