A tool for generating 3D device mockups from a screenshot.
Project description
mockupgen
A tool for generating 3D device mockups 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
--brightness B screen brightness adjustment (default: 1.0)
--contrast C screen contrast adjustment (default: 1.0)
--list list available templates
--custom-template-dir DIR use a custom directory of templates (see README.md)
Templates
A number of templates come preinstalled with the tool. 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 preinstalled templates, you can supply your own by specifying --custom-template-dir
. The directory should contain an info.json
file and all the required images. It should look something like this:
// info.json
// Note: All paths are relative to this file
[
{
// Required fields
"name": "Example Template",
"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
"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
Hashes for mockupgen-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d414dced4903b733f4d353feb5b1d0ec8777add512eed8f900f76e88beaf632a |
|
MD5 | 68c959c5dce2454e8eedbc6a6c45999e |
|
BLAKE2b-256 | 0a40ef922f5432f62d1ac4169625242df53059fcedf7194f9759456803bda0ea |