Page 1 of 1
how to achieve overlay result as shown
Posted: 2018-05-27T07:23:51-07:00
by gadgetkarepro
hello guys,
i have 2 images, 1st a png file with transparency and second image jpg .
i wish to put png file over jpg file and achieve the desired output
here are the files
top
www.thesalestore.in/top.png
bottom
www.thesalestore.in/bottom.jpg
output expected
www.thesalestore.in/out.jpg
please help me out guys
i can achieve this result in photoshop
also on website -
https://www.imgonline.com.ua/eng/impose ... icture.php
thanks
Re: how to achieve overlay result as shown
Posted: 2018-05-27T07:56:02-07:00
by Bonzo
The first thing you need to do is make a black and white mask the outside shape of the phone and with cutouts for the top T shape and bottom rectangular part.
You then need to use the mask to cut out the bottom image and then place the modified bottom image over the top image. You may need to do something to maintain the edge shadow/gradiant.
I suggest you create your mask and then come back with the mask, details of your Imagemagick version and operating system.
Re: how to achieve overlay result as shown
Posted: 2018-05-27T08:46:17-07:00
by snibgo
A simple composite does most of what you want:
Code: Select all
magick bottom.jpg top.png -composite out.png
But this doesn't make the background outside the phone transparent. There are some ways of doing that, if you want, but they are complex to handle the anti-aliasing.
Re: how to achieve overlay result as shown
Posted: 2018-05-27T10:42:01-07:00
by GeeMack
gadgetkarepro wrote: ↑2018-05-27T07:23:51-07:00i have 2 images, 1st a png file with transparency and second image jpg .
i wish to put png file over jpg file and achieve the desired output
Since the overlay "top.png" already has the transparency you need, and both images are the same dimensions,
snibgo's suggestion of a simple composite from the command line should do what you want.
Code: Select all
convert bottom.jpg top.png -composite out.jpg
That reads in the Dumbo image "bottom.jpg", then the cell phone image "top.png" with its existing transparent center area, and places the "top.png" over the "bottom.jpg". The bottom image shows through the transparent area of the top, and the result is exactly like your example "out.jpg".
If you're using IM7, use "magick" instead of "convert". If you want to adjust the quality of the output JPG you can set that with "-quality N", where N is 100 or less, just before the name of the output image.