Generating mockup of picture from image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
frareflexm
Posts: 2
Joined: 2020-02-27T05:08:12-07:00
Authentication code: 1152

Generating mockup of picture from image

Post by frareflexm »

Hi there, is there any way to generate a mockup of a picture on this kind of template?

(if i have a picture i would like to generate the mockup for a frame canvas in 3d and a poster) like thiese images


Image
Image


Thanks for help

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generating mockup of picture from image

Post by fmw42 »

If using a Unix-like environment, see my script 3Dcover at my link below.

User avatar
GeeMack
Posts: 757
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Generating mockup of picture from image

Post by GeeMack »

frareflexm wrote:
2020-02-27T05:13:04-07:00
Hi there, is there any way to generate a mockup of a picture on this kind of template?

(if i have a picture i would like to generate the mockup for a frame canvas in 3d and a poster) like thiese images
That sort of thing can be done with ImageMagick, often with just a single – but maybe quite complex – command. This command using IMv6 in *nix syntax will create the basic effect...

Code: Select all

convert logo: -bordercolor none -border 1 -crop 64x0 \( -clone 0 \
   -distort perspective "0,0 0,32 64,0 64,0 0,480 0,448 64,480 64,480" \
   -modulate 90 -write mpr:edge +delete \) -delete 0 +append \
   -distort perspective "0,0 0,0 0,480 0,480 576,0 576,32 576,480 576,448" \
   mpr:edge +swap +append -border 32 \( +clone -colorize 100 \
   -distort affine "10,0 0,10" -blur 0x10 \) +insert -composite result.png
The result there is an IM built-in image "logo:" on a transparent background. Adding a gradient background within this command should be a piece of cake if you get this far.

Obviously the dimensions and offsets will need to be adjusted for your particular input images.

If you need to do this with many pictures of different dimensions it may require some manual or scripted analysis to create the necessary command for each.

For Windows you'll need to change the continued-line backslashes "\" to carets "^" and remove the backslash escapes "\(...\)" from the parentheses "(...)".

If you're using IMv7 you can do several calculations within the command itself, so a template command could probably be written to handle a variety of input dimensions.

frareflexm
Posts: 2
Joined: 2020-02-27T05:08:12-07:00
Authentication code: 1152

Re: Generating mockup of picture from image

Post by frareflexm »

Geek, really great explanation. Thanks for help and support. The first image i have just to customize and script on different images. What about the last image? The poster version seen from an angled view?
Thanks!

User avatar
GeeMack
Posts: 757
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Generating mockup of picture from image

Post by GeeMack »

frareflexm wrote:
2020-03-05T07:32:51-07:00
What about the last image? The poster version seen from an angled view?
Again, this is just a concept command. You'll have to tweak several details to get exactly what you need.

Code: Select all

convert logo: -background none -bordercolor tan \
   -border 16 -bordercolor none -border 32 -shear -45x-10 \
   \( +clone -fill black -colorize 100 -roll +12+12 -blur 0x8 \) \
   +swap -composite +repage -gravity south -extent 50% result.png
That starts with the IM built-in "logo:", but you'll read your own image into the command at that point. It adds a "tan" border to make it obvious with the white background in the "logo:" image. You'll probably use "white". It also adds some transparent border to make space for the shadow we're going to apply.

Then it shears the image -45 degrees horizontally and -10 degrees vertically to simulate that lower angle of view.

After that it makes a clone inside the parentheses and turns that clone into a shadow with blurred edges and shifted over and down a few pixels.

Next it swaps the image and its shadow so they're in the right order, and composites the image onto the shadow.

It finishes with "-extent" to crop it down to just the center half of the bottom half.

There are many ways, some very complicated, to get that slight curve in the image and adjust the location and angle of the shadow to better match your example.

Locked