| 108 | print(" No real images found — using synthetic images.") |
| 109 | |
| 110 | def get(self, index: int, width: int, height: int) -> Image.Image: |
| 111 | if self._pool: |
| 112 | path = self._pool[index % len(self._pool)] |
| 113 | try: |
| 114 | return Image.open(path).convert("RGB").resize((width, height), Image.LANCZOS) |
| 115 | except Exception as e: |
| 116 | print(f" Warning: could not open {path}: {e} — using synthetic fallback") |
| 117 | return _synthetic_image(width, height, seed=index) |
| 118 | |
| 119 | |
| 120 | # --------------------------------------------------------------------------- |