MockupGenerator is a Ruby tool that generates realistic mockups from templates, masks, and artworks using the RMagick library.
- Generates adjustment, displacement, and lighting maps to create realistic mockups.
- Supports customization of templates and artworks.
- Uses algorithms to calculate average brightness and adjust the mockup accordingly.
- Ruby (version 2.5 or higher)
rmagick
gem- ImageMagick installed on the system
-
Install ImageMagick on your system:
-
macOS:
brew install imagemagick
-
Ubuntu/Debian:
sudo apt-get install imagemagick
-
-
Install the RMagick gem:
gem install rmagick
-
Clone the repository:
git clone https://github.com/your_username/MockupGenerator.git
-
Navigate to the project directory:
cd MockupGenerator
require 'rmagick'
require './mockup_generator'
# Paths to the files
template = "/path/to/template.jpg"
mask = "/path/to/mask.png"
artwork = "/path/to/artwork.png"
# Initialize the mockup generator
generator = MockupGenerator.new(template, mask, artwork)
# Generate the mockup
generator.generate
The generated files will be saved in the current directory:
adjustment_map.jpg
displacement_map.png
lighting_map.png
mockup.png
Base image where the artwork will be applied.
Defines the area where the artwork will be positioned on the template.
The image that will be inserted into the mockup.
After running the script, you will get a mockup with the artwork applied realistically.
-
Generation of Adjustment Map: Creates a map that adjusts the brightness and contrast of the artwork to match the template.
-
Generation of Displacement Map: Applies a displacement effect to simulate the texture and contours of the template on the artwork.
-
Generation of Lighting Map: Adjusts the lighting of the artwork to correspond with the lighting of the template.
-
Generation of the Final Mockup: Combines all the maps and applies the artwork to the template, producing the final mockup.