imagemagick - add image to transparent section -


i have image couple of transparent boxes. need insert specific images in transparent boxes. tried several convert commands couldn't end solution.

i using windows 10 , imagemagick working on cli no issues. hope can point me right direction.

let's 500x400 image starting image , has transparent holes in @ 10,10 , 250,250.

enter image description here

now, let's have 2 mr beans, bean1.jpg , bean2.jpg this:

enter image description here

enter image description here

let's lay out on red background can see going on. we'll resize bean1.jpg , place him in area of top-left transparent hole, we'll set bean2.jpg bottom-right transparent hole:

convert -size 500x400 xc:red  \    \( bean1.jpg -resize 101x101! -geometry +10+10   \) -composite \    \( bean2.jpg -resize 131x131! -geometry +250+250 \) -composite \      result.png 

enter image description here

now let's again, time, overlay original image beans peek through it:

convert -size 500x400 xc:red  \   \( bean1.jpg -resize 101x101! -geometry +10+10   \) -composite \   \( bean2.jpg -resize 131x131! -geometry +250+250 \) -composite \    image.png -composite result.png 

enter image description here

on windows, have change backslashes carets, \( becomes ^( , \) becomes ^).


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -