I'm loading 700 images and I need them to be in order according to their name's order (_DCS6825_01, _DCS6825_02...) but when try to do it, after the image _DCS6825_10 the next to load is the image _DCS6825_100, then _DCS6825_101 instead of the picture 11(_DCS6825_11), how can I solve that. this is my code:
from PIL import Image
import glob
import matplotlib.pyplot as plt
import os
path = r'C:\Users\juanc\Desktop\prueba origen\restich\\'
image_list = []
for filename in glob.glob(path+'*.jpg'):
im=Image.open(filename)
image_list.append(im)
sortedlist = sorted(image_list)
print(sortedlist)
The sorted produced an error:
TypeError: '<' not supported between instances of 'JpegImageFile' and 'JpegImageFile'
Thanks for the help