0 points

Python 2.7 script to go through sub directories


dashboard

Sun Feb 16 2020 18:21:25 GMT+0000 (UTC)

Posted by @aiastronaut #python

listing = os.listdir(path) 
num_samples=size(listing)
print num_samples

for file in listing:
    im = Image.open(path1 + '/' + file)   
    img = im.resize((img_rows,img_cols))
    gray = img.convert('L')
    gray.save(path2 +'/' +  file, "PNG")
content_copy


>> Browse more code snippets

more_vert