Given a directory of source images and a directory of transformation specifications, produce one output for every image/specification pair. Each specification contains an ordered sequence selected from grayscal…
Question
Given a directory of source images and a directory of transformation specifications, produce one output for every image/specification pair. Each specification contains an ordered sequence selected from grayscale, horizontal or vertical flip, scaling, Gaussian blur, and rotation.
```python
def process_images(
image_dir: str,
specification_dir: str,
output_dir: str,
output_path_for,
) -> None: ...
```
Use the provided naming callback for every result. Apply transformations in order and save valid output images. Scaling truncates the computed dimensions to integers; rotation expands the canvas.
## Requirements and edge cases
- Discover supported image and specification files recursively or according to the supplied listing helper.
- Do not share mutable image objects across independent pipelines.
- Ensure all scheduled work completes before returning and propagate worker failures.
- Handle corrupt images, malformed operations, zero-sized scale results, duplicate names, and output-directory creation deliberately.
- Preserve correctness before optimizing.
## Staged follow-ups
1. Write a clear sequential implementation.
2. Improve throughput for a CPU-heavy workload and justify threads versus processes.
3. Avoid repeating common transformation prefixes shared by several specifications.
4. Scale across machines and discuss task granularity, retries, storage bandwidth, and memory pressure.
5. Explain what you would measure to decide whether decoding, transformation, serialization, or disk is the bottleneck.The public brief is identical for people and crawlers. Account access changes tools, not the indexed description.