Skip to content

weirdapps/mockups

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iPhone Mockup Generator

Create pixel-perfect iPhone mockups by placing screenshots inside Apple device frames.

Uses a flood-fill masking algorithm to ensure content only appears within the screen area -- no leaking through rounded corners.

Python License

How It Works

The device frame PNGs have two transparent regions: the outer rounded corners and the inner screen area. A simple alpha check would bleed content through the corners. Instead, flood-fill starts from the screen center and finds only the connected inner transparent region, creating a precise mask.

Installation

As a CLI tool (recommended)

pipx install git+https://github.com/weirdapps/mockups.git

This installs mockup as a standalone command in an isolated environment. Install pipx with brew install pipx if needed.

As a library

pip install git+https://github.com/weirdapps/mockups.git

Usage

Command Line

# Basic (default: iPhone 16 Pro Max Black Titanium)
mockup screenshot.png

# Custom output path
mockup screenshot.png mockup.png

# Different frame
mockup screenshot.png --frame 16_pro_black

# List available frames
mockup --list-frames

Python API

from mockups import create_mockup

output = create_mockup(
    screenshot_path="screenshot.png",
    output_path="mockup.png",
    frame_key="16_pro_max_black",
)

Available Frames

Key Device
16_pro_max_black iPhone 16 Pro Max - Black Titanium (default)
16_pro_max_natural iPhone 16 Pro Max - Natural Titanium
16_pro_max_white iPhone 16 Pro Max - White Titanium
16_pro_max_desert iPhone 16 Pro Max - Desert Titanium
16_pro_black iPhone 16 Pro - Black Titanium
16_pro_natural iPhone 16 Pro - Natural Titanium

Input Requirements

  • Format: PNG or JPG (any size, automatically resized)
  • Best results: Use clean screenshots without existing frame artifacts

Output

  • Format: PNG with transparent background
  • Resolution: Full frame dimensions (1520x3068 for Pro Max, 1406x2822 for Pro)

Development

git clone https://github.com/weirdapps/mockups.git
cd mockups
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
pytest

Acknowledgments

  • Device frame images are based on Apple's publicly available product imagery. iPhone is a trademark of Apple Inc., registered in the U.S. and other countries. This project is not affiliated with or endorsed by Apple.
  • Built with Pillow and NumPy.

License

MIT

About

Pixel-perfect iPhone mockup generator using flood-fill masking

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages