for i in list_im: os.rename(path+i,path+i+'.png') img = Image.open(path+i+'.png') out = img.resize((width, height),Image.ANTIALIAS) os.remove(path+i+'.png') out.save(path+i+'.png', 'png')
imgs = [Image.open(path+i+'.png') for i in list_im] target = Image.new('RGB', (width*column, height*row_num)) for i inrange(len(list_im)): if i % column == 0: end = len(list_im) if i + column > len(list_im) else i + column for col, image inenumerate(imgs[i:i+column]): target.paste(image, (width*col, height*(i//column), width*(col + 1), height*(i//column + 1)))