Batch-generate coffee shop desk mockups for your poster or paper images using Pillow. The script places your artwork onto high-resolution overlays (a table with an espresso cup) and exports web-friendly WEBP previews.
- Two ready-to-use mockup variants (30×40 cm and 60×80 cm compositions).
- Consistent scaling, rotation, and positioning to match Photoshop layouts.
- Soft multiply blending with preserved handle highlights for realistic shadows.
- Configurable input, overlay, and output directories via command-line flags.
- Verbose logging for troubleshooting.
- Python 3.9+
- Pillow
Install dependencies:
pip install -r requirements.txt.
├── make_mockups3.py # Main script
├── overlays/ # Overlay PNG assets (mockup_30x40_tr.png, mockup_60x80_tr.png)
├── input_img/ # Place your source image files here (filenames starting with "img_")
└── output2/ # Generated mockups are written here
- Add your source artwork as WEBP, PNG, or JPG/JPEG files in
input_img/and prefix the filenames withimg_(for example,img_mountain.webp). The prefix is removed in the final output names. - Run the script from the repository root:
python make_mockups3.py --input input_img --overlays overlays --output output2Command-line options:
--input: Directory containing source image files (default:input_img).--overlays: Directory containing overlay PNG files (default:overlays).--output: Directory to write generated WEBP files (default:output2).--verbose: Enable debug-level logging.
Each source file produces two mockups:
small_<name>.webp(30×40 composition)large_<name>.webp(60×80 composition)
- Canvas and export sizes are defined at the top of
make_mockups3.pyasCANVAS_SIZEandOUTPUT_SIZE. - Shadow strength is controlled by
SHADOW_OPACITY(0–1 range); lower values yield softer shadows. - Mockup positioning, rotation, and overlay filenames live in the
MOCKUPSmapping within the script. Adjust these values if you add new overlays or need different placements.
- Code: MIT License. Copyright (c) 2025 Philip Vincent Jancsy. See
LICENSE. - Overlay image assets (
overlays/): Creative Commons Attribution 4.0 International (CC BY 4.0). Copyright (c) 2025 Philip Vincent Jancsy. SeeLICENSE_ASSETS.