putting tile on image background is also changing need help

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

Re: putting tile on image background is also changing need h

Post by bijalbhavsar99 »

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 :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: putting tile on image background is also changing need h

Post by fmw42 »

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
bijalbhavsar99
Posts: 15
Joined: 2014-04-07T03:23:42-07:00
Authentication code: 6789

Re: putting tile on image background is also changing need h

Post by bijalbhavsar99 »

HI
Thank you for replay
my pattern image
http://oi59.tinypic.com/15q4vhx.jpg
my clone image
http://oi60.tinypic.com/2llf5oo.jpg
Output image
http://oi60.tinypic.com/2iasdy1.jpg

yes i check this code also but not luck
http://oi60.tinypic.com/2zi0nq0.jpg

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
Thanks
Bijal Bhavsar :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: putting tile on image background is also changing need h

Post by fmw42 »

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
Image

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
Image
bijalbhavsar99
Posts: 15
Joined: 2014-04-07T03:23:42-07:00
Authentication code: 6789

Re: putting tile on image background is also changing need h

Post by bijalbhavsar99 »

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 :)
Post Reply