How to overlay an Image on the base 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?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to overlay an Image on the base Image

Post by fmw42 »

hiren wrote:Thanks fmw42,

But how can I merge the shirt elbow fabric?

Image

It is not looking proper.

Your white sleeve image has gray areas where you see these seems above that you have circled. Paint and/or blur out just those gray areas in the white sleeve image to be more white and try again. Use PS or GIMP to do the painting or blurring.
hiren
Posts: 6
Joined: 2015-07-11T12:43:39-07:00
Authentication code: 1151

Re: How to overlay an Image on the base Image

Post by hiren »

I found a solution to hide that image separation.
I make the edges more sharp and remove that white border using following.

Code: Select all

convert -size 600x600 tile:fabric.jpg fab_red_new.png

convert fab_red_new.png -rotate 20 -gravity southeast -extent 1200x1200-600-590 -transparent white -fuzz 10% -fill none -bordercolor black -draw "matte 0,0 floodfill"  \
-channel alpha -morphology erode octagon:1 +channel fabric-sleeves-left-top.png
convert fab_red_new.png -rotate -39 -gravity southeast  -extent 1200x1200-600-0 -transparent white -fuzz 10% -fill none -bordercolor black -draw "matte 0,0 floodfill"  \
-channel alpha -morphology erode octagon:1 +channel fabric-sleeves-left-bottom.png
convert fabric-sleeves-left-bottom.png fabric-sleeves-left-top.png -geometry 1200X1200+0+0 -composite -transparent white sleeve_left_fabric.png


convert fab_red_new.png -rotate -20 -gravity southwest  -extent 1200x1200-600-580 -transparent white -fuzz 10% -fill none -bordercolor black -draw "matte 0,0 floodfill"  \
-channel alpha -morphology erode octagon:1 +channel fabric-sleeves-right-top.png
convert fab_red_new.png -rotate 15 -gravity southwest  -extent 1200x1200-600-0 -transparent white -fuzz 10% -fill none -bordercolor black -draw "matte 0,0 floodfill"  \
-channel alpha -morphology erode octagon:1 +channel fabric-sleeves-right-bottom.png
convert fabric-sleeves-right-bottom.png fabric-sleeves-right-top.png -geometry 1200X1200+0+0 -composite -transparent white sleeves_right_fabric.png


convert sleeve_left_fabric.png sleeves_right_fabric.png -geometry 1200X1200+0+0 -composite -transparent white sleeve_full_fabric.png

fact=`convert shirt_sleeve_full_front.png -auto-level -scale 1x1! -format "%[fx:0.5/mean]" info:`
convert \( shirt_sleeve_full_front.png -auto-level -evaluate multiply $fact -sigmoidal-contrast 10x50% \) sleeve_full_fabric.png \
\( -clone 1 -clone 0 -alpha set -virtual-pixel transparent -compose displace -set option:compose:args -5x-5 -composite \) \
-delete 1 -compose hardlight -composite sleeve_full.png

And I got following result
Image

Thanks for help :D
Post Reply