(folder, width, height)
| 30 | |
| 31 | |
| 32 | def load_images_from_folder(folder, width, height): |
| 33 | images = [] |
| 34 | files = os.listdir(folder) |
| 35 | png_files = [f for f in files if f.endswith('.png')] |
| 36 | png_files.sort(key=lambda x: int(x.split('_')[1].split('.')[0])) |
| 37 | for filename in png_files: |
| 38 | img = Image.open(os.path.join(folder, filename)).convert('RGB') |
| 39 | img = img.resize((width, height)) |
| 40 | images.append(img) |
| 41 | |
| 42 | return images |
| 43 | |
| 44 | def export_to_gif(frames, output_gif_path, fps): |
| 45 | """ |