All projects · Automation & Data Pipelines
Image Captioning & Cropping API: Cloud Run Microservice & n8n Pipeline
A production-grade Python FastAPI visual preprocessing microservice that downloads public image URLs (no multipart uploads), calculates…
A production-grade Python FastAPI visual preprocessing microservice that downloads public image URLs (no multipart uploads), calculates mathematical aspect crops with OpenCV and NumPy, overlays a 3-word caption on a bottom-center contrast banner with Pillow, enforces header-based API key authentication, and integrates with n8n automation pipelines and Google Cloud Run Docker containers.
- Ingests direct public image links (e.g. postimg.org) via JSON payload and strictly rejects multipart file uploads
- Calculates center-crop bounding boxes using OpenCV and NumPy for undistorted edge-to-edge canvas filling
- Overlays 3-word caption ('Do The Courses') centered horizontally and vertically inside a solid black footer banner
- Enforces header-based API key authentication (X-API-Key) using constant-time secrets.compare_digest verification
- Integrates directly with n8n HTTP Request node and emits binary JPEG image streams
- Containerized with a production multi-stage Dockerfile deployed to Google Cloud Run via Google Cloud Shell
- Includes an Interactive In-Browser Studio with live OpenCV/Pillow simulation, 3-word counter, n8n visualizer, and 8-point diagnostic test runner
Built with: FastAPI, Python 3.11, OpenCV Headless, Pillow, NumPy, Docker, Google Cloud Run, n8n Automation, REST API