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")
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter