What this prompt does
This prompt makes the AI design and build a complete Python image-processing pipeline tailored to your [use_case], sized for the throughput you declare in [daily_volume] and [avg_file_size]. It pins the toolchain with [python_version] and [image_library], then asks for a chainable builder API where each step — resize, convert, watermark, optimize, save — is optional and composable. Because you state the volume and average file size up front, the AI can reason about concurrency and memory instead of producing toy code that falls over on real batches.
The structure works because it forces concrete decisions at every layer. [resize_modes] and [smart_crop_method] define how variants are derived from a source; [output_format], [jpeg_quality], and [avif_support] control encoding tradeoffs; [watermark_text] and [watermark_opacity] shape branding; and [custom_metadata] plus the EXIF-stripping rules cover privacy. The [concurrency_type], [input_source], and [output_structure] variables turn it from a single-image script into a batch system with a processing report and resume-by-hash recovery. The [size_variants] and [size_limits] variables push the AI to derive a fixed set of outputs per source and enforce a ceiling on each, while the automatic-format-selection logic decides between JPEG, WebP, PNG, and AVIF based on whether an image is a photograph or a graphic with transparency. Spelling out [quality_target] keeps the encoder from optimizing for size at the expense of visible artifacts, or the reverse.
When to use it
- You run an e-commerce or media app where every upload needs several optimized variants
- You need to strip GPS and camera-serial metadata before publishing images publicly
- You want WebP or AVIF output with a JPEG fallback to cut delivery size
- You process thousands of files per run and need resume capability after a crash
- You need smart-cropped thumbnails that keep the focal point instead of blind center crops
- You want a quality-assurance pass that catches corrupted output before it ships
Example output
The AI returns a structured Python codebase: a Pipeline class exposing the chainable builder methods, supporting modules for resizing, format conversion, watermarking, and metadata handling, plus a batch runner that reads from [input_source], writes to [output_structure], and emits a processing report (total, successful, failed, skipped duplicates). Expect method signatures with return types, a hash-tracking resume mechanism, and a QA step that re-opens output to confirm it is not corrupt.
Pro tips
- Set
[avg_file_size]honestly — large source files are why the prompt suggests libvips alongside Pillow in[image_library] - Match
[concurrency_type]to your CPU count; a ProcessPoolExecutor with too many workers thrashes on memory-heavy images - Be explicit in
[resize_specs]and[size_variants]so the AI generates the exact variant set your CDN expects - Keep
[quality_target]and[size_limits]aligned — asking for under 200KB while demanding quality 95 will conflict - Name real fields in
[custom_metadata](product_id, sku) so the injected metadata is queryable later - If privacy matters, double-check the AI actually strips GPS/serial fields rather than only copying copyright tags