Page 2 of 4

Re: How to overlay an Image on the base Image

Posted: 2014-04-13T23:06:38-07:00
by pratik123
fmw42 wrote:what version of IM are you using?

try adding -respect-parenthesis

Code: Select all

convert -respect-parenthesis sleeves.png pattern.png \
\( -size 440x440 gradient: -solarize 50% -level 0x50% \) \
\( -clone 2 -rotate 90 \) \
\( -clone 2 -clone 3 -compose multiply -composite -negate -scale 440x600! \) \
\( -clone 4 -negate \) \
\( -size 600x440 gradient: -rotate 90 -set colorspace RGB -threshold 50% \) \
\( -clone 4 -clone 5 -clone 6 -compose over -composite -scale 300% -gravity center -crop 440x600+0-30 +repage \) \
\( -clone 1 -clone 7 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -100x-100 -composite \) \
-delete 1-7 \
\( -clone 0 -auto-level \) \
\( -clone 1 -clone 0 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -5x-5 -composite \) \
-delete 0,1 -compose multiply -composite sleeves_pattern21_displace_twice.png
hi i am using latest version of imagemagick 6.8.9 in ubantu os .

I try your code and this time different pattern generate.
please see url

http://oi57.tinypic.com/lzhno.jpg

Thank you

Re: How to overlay an Image on the base Image

Posted: 2014-04-14T10:56:13-07:00
by fmw42
First you are using the poorer of the versions. You should be using
convert sleeves.png pattern.png \
\( -size 440x440 gradient: -solarize 50% -level 0x50% \) \
\( -clone 2 -rotate 90 \) \
\( -clone 2 -clone 3 -compose multiply -composite -negate -resize 440x600! \) \
\( -clone 4 -negate \) \
\( -size 600x440 gradient: -rotate 90 -set colorspace RGB -threshold 50% \) \
\( -clone 4 -clone 5 -clone 6 -compose over -composite -resize 300% -gravity center -crop 440x600+0-30 +repage \) \
\( -clone 1 -clone 7 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -100x-100 -composite \) \
-delete 1,2,3,4,5,6,7 \
\( -clone 0 -auto-level \) \
\( -clone 1 -clone 0 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -5x-5 -composite \) \
-delete 0,1 -compose multiply -composite sleeves_pattern_displace_twice_b.png
However, both examples were created at the time IM had colorspace issues. To fix it for current versions of IM. remove the -set colorspace RGB as marked in red above and corrected as follows.

Code: Select all

convert sleeves.png pattern.png \
\( -size 440x440 gradient: -solarize 50% -level 0x50% \) \
\( -clone 2 -rotate 90 \) \
\( -clone 2 -clone 3 -compose multiply -composite -negate -resize 440x600! \) \
\( -clone 4 -negate \) \
\( -size 600x440 gradient: -rotate 90 -threshold 50% \) \
\( -clone 4 -clone 5 -clone 6 -compose over -composite -resize 300% -gravity center -crop 440x600+0-30 +repage \) \
\( -clone 1 -clone 7 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -100x-100 -composite \) \
-delete 1,2,3,4,5,6,7 \
\( -clone 0 -auto-level \) \
\( -clone 1 -clone 0 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -5x-5 -composite \) \
-delete 0,1 -compose multiply -composite sleeves_pattern_displace_twice_b.png

Re: How to overlay an Image on the base Image

Posted: 2014-04-14T22:25:32-07:00
by bijalbhavsar99
Hi
I try following command for sleeves
convert sleeves.png pattern.png \
\( -clone 0 -auto-level \) \
\( -clone 1 -clone 0 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -5x-5 -composite \) \
-delete 0,1 -compose multiply -composite sleeves_pattern.png

and its generate following image

http://oi62.tinypic.com/10pybl2.jpg

as per your suggestion i try to apply pattern in dimond shape using following command but not success

convert -respect-parenthesis sleeves.png pattern.png \
\( -size 440x440 gradient: -solarize 50% -level 0x50% \) \
\( -clone 2 -rotate 90 \) \
\( -clone 2 -clone 3 -compose multiply -composite -negate -scale 440x600! \) \
\( -clone 4 -negate \) \
\( -size 600x440 gradient: -rotate 90 -threshold 50% \) \
\( -clone 4 -clone 5 -clone 6 -compose over -composite -scale 300% -gravity center -crop 440x600+0-30 +repage \) \
\( -clone 1 -clone 7 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -100x-100 -composite \) \
-delete 1-7 \
\( -clone 0 -auto-level \) \
\( -clone 1 -clone 0 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -5x-5 -composite \) \
-delete 0,1 -compose multiply -composite sleeves_pattern_displace_twice.png


Thank you for clear about using " -respect-parenthesis "

Thank you
Bijal

Re: How to overlay an Image on the base Image

Posted: 2014-04-14T22:26:40-07:00
by fmw42
What version of IM and what platform? If too old, then the single command line may not work. See the modified script right above your post. Post any error messages and the result of running the modified script.

I try following command for sleeves
convert sleeves.png pattern.png \
\( -clone 0 -auto-level \) \
\( -clone 1 -clone 0 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -5x-5 -composite \) \
-delete 0,1 -compose multiply -composite sleeves_pattern.png
You have no displacement map in this code. So the pattern will not displace. See
http://www.imagemagick.org/Usage/mappin ... e_displace
http://www.imagemagick.org/script/compose.php

Re: How to overlay an Image on the base Image

Posted: 2014-04-14T22:45:51-07:00
by bijalbhavsar99
hi i am using latest version of imagemagick 6.8.9.0

Yes i try your following code

Code: Select all

convert sleeves.png pattern.png \
\( -size 440x440 gradient: -solarize 50% -level 0x50% \) \
\( -clone 2 -rotate 90 \) \
\( -clone 2 -clone 3 -compose multiply -composite -negate -resize 440x600! \) \
\( -clone 4 -negate \) \
\( -size 600x440 gradient: -rotate 90 -threshold 50% \) \
\( -clone 4 -clone 5 -clone 6 -compose over -composite -resize 300% -gravity center -crop 440x600+0-30 +repage \) \
\( -clone 1 -clone 7 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -100x-100 -composite \) \
-delete 1,2,3,4,5,6,7 \
\( -clone 0 -auto-level \) \
\( -clone 1 -clone 0 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -5x-5 -composite \) \
-delete 0,1 -compose multiply -composite sleeves_pattern_displace_twice_b.png


and its generate output image
http://oi59.tinypic.com/j6reia.jpg

Thank you

Re: How to overlay an Image on the base Image

Posted: 2014-04-14T23:06:59-07:00
by fmw42
What platform - unix or window?

Your result is not correct. When I run the same code on IM 6.8.9.0 Q16 Mac OSX, I get.

Image

If you are on Windows, then some syntax changes are needed. See http://www.imagemagick.org/Usage/windows/.

Re: How to overlay an Image on the base Image

Posted: 2014-04-14T23:13:54-07:00
by bijalbhavsar99
Hi
Thank you for reply
i am using linux - mint os in my machine.

Thank you

Re: How to overlay an Image on the base Image

Posted: 2014-04-14T23:20:48-07:00
by fmw42
Something is going wrong with one or more steps. Use -write tmpX.png to see what that might be. Run the following and look at tmp1.png - tmp3.png and compare to mine.

convert sleeves.png pattern.png \
\( -size 440x440 gradient: -solarize 50% -level 0x50% \) \
\( -clone 2 -rotate 90 \) \
\( -clone 2 -clone 3 -compose multiply -composite -negate -resize 440x600! \) \
\( -clone 4 -negate -write tmp1.png \) \
\( -size 600x440 gradient: -rotate 90 -threshold 50% -write tmp2.png \) \
\( -clone 4 -clone 5 -clone 6 -compose over -composite -resize 300% -gravity center -crop 440x600+0-30 +repage -write tmp3.png \) \
\( -clone 1 -clone 7 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -100x-100 -composite \) \
-delete 1,2,3,4,5,6,7 \
\( -clone 0 -auto-level \) \
\( -clone 1 -clone 0 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -5x-5 -composite \) \
-delete 0,1 -compose multiply -composite sleeves_pattern_displace_twice_b.png

http://www.fmwconcepts.com/misc_tests/d ... p/tmp1.png
http://www.fmwconcepts.com/misc_tests/d ... p/tmp2.png
http://www.fmwconcepts.com/misc_tests/d ... p/tmp3.png


Perhaps replace resize 440x600! with either "440x600!" or 440x600\!

Re: How to overlay an Image on the base Image

Posted: 2014-04-14T23:30:03-07:00
by bijalbhavsar99
Hi i am using latest version of IM
And i already adding -respect-parenthesis but not success its generate same image for output

http://tinypic.com/view.php?pic=lzhno&s=8#.U0zRnPg5rqQ

I am not sure whats going wrong ... :( :(

Thank you for quick response...

Re: How to overlay an Image on the base Image

Posted: 2014-04-14T23:37:36-07:00
by bijalbhavsar99
HI
tmp1.png image is wrong
please see tmp1 image output.

http://oi60.tinypic.com/2emzyac.jpg

Thank you

Re: How to overlay an Image on the base Image

Posted: 2014-04-15T02:02:47-07:00
by bijalbhavsar99
Hi
yes you r right problem in version its work in live server.

Thank you

Re: How to overlay an Image on the base Image

Posted: 2015-01-07T22:36:22-07:00
by Somat
Hi
I have completed all shirt parts but i am facing problem to apply pattern on collar parts.Pleaase guide me how can i achieve it.
This is my clone image.
Image
This is my pattern.
Image
I want to this type result.
Image
Thank you for help

Re: How to overlay an Image on the base Image

Posted: 2015-04-22T03:22:13-07:00
by eimahendravala
Hi There,

I have same issue for blend fabric images.

I have original image:
http://tfy.info/im/sleeve_right.1.png

Where I am trying to overlay the fabric http://tfy.info/im/fabric.5.png .

I have executed
<pre>
convert -respect-parenthesis sleeve_right.1.png fabric.5.png \
\( -size 440x440 gradient: -solarize 50% -level 0x50% \) \
\( -clone 2 -rotate 90 \) \
\( -clone 2 -clone 3 -compose multiply -composite -negate -scale 440x600! \) \
\( -clone 4 -negate \) \
\( -size 600x440 gradient: -rotate 90 -set colorspace RGB -threshold 50% \) \
\( -clone 4 -clone 5 -clone 6 -compose over -composite -scale 300% -gravity center -crop 440x600+0-30 +repage \) \
\( -clone 1 -clone 7 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -100x-100 -composite \) \
-delete 1-7 \
\( -clone 0 -auto-level \) \
\( -clone 1 -clone 0 -alpha set -virtual-pixel transparent -compose displace \
-set option:compose:args -5x-5 -composite \) \
-delete 0,1 -compose multiply -composite sleeves_pattern21_displace_twice.png
</pre>

and I got this http://tfy.info/im/mycomingopt.png as output.

I want output something like this http://tfy.info/im/myexpectedopt.png.

Is there any possible way for this.

Thanks & Regards
Mahendra Vala

Re: How to overlay an Image on the base Image

Posted: 2015-04-22T13:27:01-07:00
by fmw42
Code for one shape and size item is not relevant to another shape and size item. This is especially true here, since the original item had two sleeves and yours has only one. See the basic concept at viewtopic.php?f=1&t=16921#p62696 and viewtopic.php?f=1&t=22890&start=15. Bending the pattern is an additional step as described above.

Re: How to overlay an Image on the base Image

Posted: 2015-04-22T21:46:41-07:00
by eimahendravala
Thanks a lot fmw42,

Those are pretty good example for overlay image on image with wave effect but I have problem overlay image with smooth blend. It might possible that what I am looking for is answered in given post but I don't understand how to apply it. Can you help me out please?

Again thanks a lot.

Thanks - Mahendra Vala


fmw42 wrote:Code for one shape and size item is not relevant to another shape and size item. This is especially true here, since the original item had two sleeves and yours has only one. See the basic concept at viewtopic.php?f=1&t=16921#p62696 and viewtopic.php?f=1&t=22890&start=15. Bending the pattern is an additional step as described above.