(folder)
| 157 | # return images |
| 158 | |
| 159 | def load_images_from_folder(folder): |
| 160 | images = [] |
| 161 | |
| 162 | files = os.listdir(folder) |
| 163 | png_files = [f for f in files if f.endswith('.png')] |
| 164 | png_files.sort(key=lambda x: int(x.split('_')[1].split('.')[0])) |
| 165 | for filename in png_files: |
| 166 | img = Image.open(os.path.join(folder, filename)).convert('RGB') |
| 167 | images.append(img) |
| 168 | |
| 169 | return images |
| 170 | |
| 171 | |
| 172 | # copy from https://github.com/crowsonkb/k-diffusion.git |