A tool that generates a 3D device mockup from a screenshot.
Project description
mockupgen
A tool that generates a 3D device mockup from a screenshot.
Installation
pip install mockupgen
Alternatively, from source:
git clone https://github.com/rmenon1008/mockupgen.git
cd mockupgen
pip install .
Usage
mockupgen [OPTION...] screenshot_file
OPTION:
-t TEMPLATE template name or number
-o OUTFILE output file name (use extension to specify format)
-w WIDTH output width (will upscale if requested)
--crop crop instead of stretching the screenshot to fit the mockup
--rotate number of times to rotate the screenshot 90 degrees ccw
--brightness B screen brightness adjustment (default: 1.0)
--contrast C screen contrast adjustment (default: 1.0)
--list list available templates
--custom-templates PATH/URL specify a custom directory of templates (see README.md)
Templates
The mockupgen-templates
repository contains the default templates used by mockupgen
. They are all based on mockups created by Anthony Boyd. You can see the available templates with mockupgen --list
.
Custom templates
Instead of using the default templates, you can supply your own by specifying --custom-template-dir
. The directory or URL should contain an index.json file with the following format:
// index.json
// Note: All paths are relative to this file
{
"index_version": 1.0, // Version of the template index
"templates": [
{
// Required fields
"name": "Macbook Pro 16 Silver (Green Background)",
"slug": "mbp-16-silver-green", // Try to follow device-size-color-background format
"base_file": "base.png", // The device template image
"screen_points": [ // The pixel locations of the 4 corners of the screen
[896, 224], // Starts in the top left and goes counter clockwise
[896, 654],
[1471, 985],
[1471, 555]
],
// Only one of the two options below must be specified
"mask_file": "mask.png", // An image used to mask the screenshot (alpha channel used)
// OR
"mask_aspect_ratio": 1.0, // Aspect ratio to mask the screenshot (assumes rectangular)
// Optional fields
"black_white_point": ["292826", "D9DCDD"], // Black and white points
// for color correction
"brightness": 1.0, // Brightness adjustment of the screenshot
"contrast": 1.0 // Contrast adjustment of the screenshot
},
...
]
}
About
Mockups typically require expensive and slow image processing tools to create. While these can create very realistic mockups, they're very manual and usually overkill for the blog post thumbnail I'm trying to create.
The tool uses opencv to mask, warp and composite screenshots onto a template. Right now, it doesn't do any lighting or shadow effects.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mockupgen-1.5.1.tar.gz
.
File metadata
- Download URL: mockupgen-1.5.1.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a49ff048266db19ed8ba93d0c81afaa71c408cd2a2cce8af1a9286a583d253d |
|
MD5 | 3aee13d5574719f5fb1be3ad3f136398 |
|
BLAKE2b-256 | dd881330ef486778633284228721f84a2e3727f3a5b994f815dcb0f2092de365 |
File details
Details for the file mockupgen-1.5.1-py3-none-any.whl
.
File metadata
- Download URL: mockupgen-1.5.1-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bc8cfb69c0ea1d5e0092ca674ecc78794d7dbf8810a2f65271fa533a41b2ce9 |
|
MD5 | 72ad8f40c66b8dd6654b0cfca7d138e9 |
|
BLAKE2b-256 | 7184a3af95eab7e9c045bb750d8c359a70f0180ac9bc833709cf8611c34e269d |