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?".
bijalbhavsar99
Posts: 15 Joined: 2014-04-07T03:23:42-07:00
Authentication code: 6789
Post
by bijalbhavsar99 » 2014-04-15T22:37:00-07:00
Hi fmw42,
I am facing one issue with slight curve in shoulder part of body.
I have tried below code to achieve it.
Code: Select all
exec("convert pattern.png \
\( mainbody_clone.png -blur '0x3' -auto-level \) -alpha set -virtual-pixel transparent \
-compose displace -set option:compose:args '2x-20' -composite displace_body.png ");
exec("convert displace_body.png mainbody_clone.png -compose multiply -composite final_body.png");
But couldn't achieve it.
This is output of my image
http://oi61.tinypic.com/5v3urd.jpg
I and looking for
http://oi60.tinypic.com/1195l6g.jpg
Thank You for help
Bijal Bhavsar
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2014-04-15T22:51:38-07:00
I cannot test your code without all the input images.
You probably need to manual shade the shoulders in your white shirt body image to achieve such fine tuning.
You did not copy the code correctly from earlier in the post. It should be -20x-20 (not 2x-20) for the displace argument:
Code: Select all
convert body.png -background black -alpha background 2body.png
convert fabric.png \
\( 2body.png -blur "0x3" -auto-level \) -alpha set -virtual-pixel transparent \
-compose displace -set option:compose:args "-20x-20" -composite 2displace_body.png
convert 2displace_body.png 2body.png -compose multiply -composite 2body_displace_composite.png
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2014-04-16T10:10:14-07:00
try this and adjust the blur and displacement arguments as desired
Code: Select all
convert mainbody_clone.png -background black -alpha background mainbody_clone2.png
convert pattern.png \
\( mainbody_clone2.png -alpha off -blur 0x3 -alpha on -auto-level \) -alpha set -virtual-pixel transparent \
-compose displace -set option:compose:args "-10x-10" -composite 2displace_body.png
convert 2displace_body.png mainbody_clone.png -compose multiply -composite result1.png
or just blur the shoulders and above
Code: Select all
convert mainbody_clone.png -background black -alpha background mainbody_clone2.png
convert -respect-parenthesis pattern.png mainbody_clone2.png \
\( -clone 1 -alpha off -blur 0x3 -alpha on -gravity north -crop 440x125+0+0 +repage \
-clone 1 -gravity south -crop 440x475+0+0 +repage -append -auto-level \) \
-delete 1 -alpha set -virtual-pixel transparent \
-compose displace -set option:compose:args "-10x-10" -composite 2displace_body.png
convert 2displace_body.png mainbody_clone.png -compose multiply -composite result2.png
bijalbhavsar99
Posts: 15 Joined: 2014-04-07T03:23:42-07:00
Authentication code: 6789
Post
by bijalbhavsar99 » 2014-04-17T01:45:04-07:00
Hi
Thank you so much its work i change displace parameter as per your suggestion
convert mainbody_clone.png -background black -alpha background mainbody_clone2.png
convert -respect-parenthesis pattern.png mainbody_clone2.png \
\( -clone 1 -alpha off -blur 0x3 -alpha on -gravity north -crop 440x125+0+0 +repage \
-clone 1 -gravity south -crop 440x475+0+0 +repage -append -auto-level \) \
-delete 1 -alpha set -virtual-pixel transparent \
-compose displace -set option:compose:args "5x5 " -composite 2displace_body.png
convert 2displace_body.png mainbody_clone.png -compose multiply -composite result2.png
Thanks for help.
Bijal Bhavsar