Here is a tiny little python code which helps to arrange all the random images into ordered set of images for Machine Learning or for any use
- PYTHON
- Necessary Import Modules
from PIL import Image
import glob, os
import itertools
counter = itertools.count()
size = 500, 300
for infile in glob.glob("*.jpg"):
file, ext = os.path.splitext(infile)
im = Image.open(infile)
im.thumbnail(size)
im.save("image" + str(next(counter)) +".jpg", "JPEG")