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?".
User avatar
fmw42
Posts: 23845
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 » 2012-03-13T11:09:32-07:00

I cannot say whether an upgrade would work. But your version is about 140 versions old.

The best way to test is to run the command from the command line (terminal) and see if you have the same problem. That way you know if it is an IM or PHP/Apache issue.

sujan.dasmahapatra
Posts: 44
Joined: 2012-02-18T21:42:01-07:00
Authentication code: 8675308

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

Post by sujan.dasmahapatra » 2012-03-13T23:44:16-07:00

I have upgraded the version and now it's working fine. But now the balck partition lines are very prominent. Please see this picture how can I remove the black partitions.
http://imageshack.us/photo/my-images/5 ... mod6.png/

my code is like this

Code: Select all

exec("convert bodynormalclassic_mod6.png sleevelongnormal_mod6.png collar104o_mod6.png cuff114o_mod6.png --fuzz 20% -transparent black -background black -flatten miff:- | convert - -median 3x3  shirtmod6.png");

sujan.dasmahapatra
Posts: 44
Joined: 2012-02-18T21:42:01-07:00
Authentication code: 8675308

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

Post by sujan.dasmahapatra » 2012-03-14T00:17:21-07:00

even after running from command line also these black partition lines are coming. If this problem is sorted out then i think i am done with this to some extent. please help
[img]
C:\temp\shirtmod61
[/img]

User avatar
fmw42
Posts: 23845
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 » 2012-03-14T10:52:06-07:00

make the median bigger -- try 5x5 or try changing the the -fuzz value up or down. Also note you have one too many minus signs:
convert bodynormalclassic_mod6.png sleevelongnormal_mod6.png collar104o_mod6.png cuff114o_mod6.png --fuzz 20% -transparent black -background black -flatten miff:- | convert - -median 3x3 shirtmod6.png
should be

convert bodynormalclassic_mod6.png sleevelongnormal_mod6.png collar104o_mod6.png cuff114o_mod6.png -fuzz 20% -transparent black -background black -flatten miff:- | convert - -median 3x3 shirtmod6.png

Try also

convert bodynormalclassic_mod6.png sleevelongnormal_mod6.png collar104o_mod6.png cuff114o_mod6.png -fuzz 20% -transparent black -background black -flatten -median 3x3 shirtmod6.png

What version of IM are you using? -median syntax changed at IM 6.6.8-6 If your IM is older than that, then try -median 1 or -median 3 etc

mahak2050
Posts: 11
Joined: 2012-07-11T08:55:23-07:00
Authentication code: 13

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

Post by mahak2050 » 2012-08-14T00:01:44-07:00

fmw42 wrote:As Anthony suggested, you can try to use the shirt as a displacement map to distort the stripes when placing onto the shirt. See a similar example at viewtopic.php?f=1&t=16921&p=62696&hilit ... irt#p62696


convert 15898.png \( sleevelongnormal.png -blur 0x3 -auto-level \) -alpha set \
-virtual-pixel transparent -compose displace \
-set option:compose:args -20x-20 -composite 1598_displace.png

convert 1598_displace.png 1sleevelongnormal.png -compose multiply -composite sleevelongnormal_disp_comp.png

Image

However, it does not take into account the bent arms. Sorry, but I don't know how to deal with that. Seems you would need a 3D texture mapping system with 3D model of your shirt.
Hi,

I tried the above commands and they are working when I am doing it on my PC ( Windows - IM 6.7.x (installed)) but the problem is these commands are not working on the server ( Linux - IM 6.7.x (installed)).
I am writing the command and also providing the images links, Please let me know whats wrong here.

body.png : http://osc-customisation.com/traceprint/IM/body.png
fabric.png : http://osc-customisation.com/traceprint/IM/body.png

Image
Image

$cmd1 = 'convert fabric.png ( body.png -blur "0x3" -auto-level ) -alpha set -virtual-pixel transparent -compose displace -set option:compose:args "-20x-20" -composite displace_body.png';
exec("/usr/bin/convert $cmd1 ");
$cmd2 = 'convert displace_body.png body.png -compose multiply -composite body_dispplace_composite.png';
exec("/usr/bin/convert $cmd2 ");

And here these commands are not giving the results.
I also tried without double quotes "0x3" => 0x3 And "-20x-20" => -20x-20

Please let me know what is the issue and how can be resolved??

Thanks
Mahak

User avatar
fmw42
Posts: 23845
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 » 2012-08-14T10:12:01-07:00

Your command works fine for me on IM 6.7.8.10 Q16 Mac OSX Snow Leopard and produces a result as expected. You don't show your result, so it is hard to understand what you think is not working.

Here is what I get on my Mac

convert 1fabric.png \
\( 1body.png -blur "0x3" -auto-level \) -alpha set -virtual-pixel transparent \
-compose displace -set option:compose:args "-20x-20" -composite 1displace_body.png
convert 1displace_body.png 1body.png -compose multiply -composite 1body_dispplace_composite.png


Image

Note that after IM 6.7.6.7 there have been lots of changes to IM colorspace and grayscale. Or perhaps you just have a bad release. So you need to identify the full 4 digit version.

mahak2050
Posts: 11
Joined: 2012-07-11T08:55:23-07:00
Authentication code: 13

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

Post by mahak2050 » 2012-08-14T14:31:17-07:00

fmw42 wrote:Your command works fine for me on IM 6.7.8.10 Q16 Mac OSX Snow Leopard and produces a result as expected. You don't show your result, so it is hard to understand what you think is not working.

Here is what I get on my Mac

convert 1fabric.png \
\( 1body.png -blur "0x3" -auto-level \) -alpha set -virtual-pixel transparent \
-compose displace -set option:compose:args "-20x-20" -composite 1displace_body.png
convert 1displace_body.png 1body.png -compose multiply -composite 1body_dispplace_composite.png


Image

Note that after IM 6.7.6.7 there have been lots of changes to IM colorspace and grayscale. Or perhaps you just have a bad release. So you need to identify the full 4 digit version.
Thanks for your reply, and here is the information you requested

My IM Version Info.:
Version: ImageMagick 6.7.6-8 2012-05-02 Q16

So let me know If there are changes made in this version for IM colorspace and grayscale. How can I change the command to get the result.
The result ( the shirt image ) you get at your the same result I am getting on my local computer ( Windows, IM 6.7.7-Q16 ) but on the server ( Linux, Version: ImageMagick 6.7.6-8 2012-05-02 Q16 ) I am not getting anything.

You don't show your result, so it is hard to understand what you think is not working.
When I am executing this command in PHP, It not giving me any result. Means Its not creating displace_body.png on the server.
$cmd1 = 'convert fabric.png ( body.png -blur "0x3" -auto-level ) -alpha set -virtual-pixel transparent -compose displace -set option:compose:args "-20x-20" -composite displace_body.png';
exec("/usr/bin/convert $cmd1 ");

Please let me know what should I do to get the shirt image as you got it at your end and I am getting the same on my local System.

Thanks
Mahak

User avatar
fmw42
Posts: 23845
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 » 2012-08-14T15:38:54-07:00

I get the same result as I did before using IM 6.7.6.8 Q16 Mac OSX Snow Leopard. So I suspect your configuration is not correct on that server.
Also 6.7.6.8 is right on the cusp of some of the changes made to IM. However, they did not affect my running of the command.

mahak2050
Posts: 11
Joined: 2012-07-11T08:55:23-07:00
Authentication code: 13

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

Post by mahak2050 » 2012-08-15T20:56:28-07:00

fmw42 wrote:I get the same result as I did before using IM 6.7.6.8 Q16 Mac OSX Snow Leopard. So I suspect your configuration is not correct on that server.
Also 6.7.6.8 is right on the cusp of some of the changes made to IM. However, they did not affect my running of the command.
Thanks Fred,

I got it and I was not adding the slashes in the command. ( \( 1body.png -blur "0x3" -auto-level \) ) so now Its working.

But now I have another problem, when I am using the transparent image then It does not bled the strip on the sholders and when I use the balack background image It does. but again te problem with the black background image is that It leaves Black pixels on edge of the shirt.
I am giving you both the results here and you will see the difference.

This is for Transparent Shirt Image :
fabric.png : Image
body.png : Image
convert fabric.png \( body.png -blur "0x3" -auto-level \) -alpha set -virtual-pixel transparent -compose displace - set option:compose:args "-10x-10" -composite dis_31.png

convert dis_31.png body.png -compose multiply -composite dis_32.png

Result 1 : Image

This is for Balck Backgriund Shirt Image :
body_black.png:Image
convert fabric.png \( body_black.png -blur "0x3" -auto-level \) -alpha set -virtual-pixel transparent -compose displace -set option:compose:args "-10x-10" -composite dis_41.png

convert dis_41.png body_black.png -compose multiply -composite dis_42.png

convert dis_42.png -transparent Black dis_42.png

Result 2 : Image

So please let me know how can we remove the Black pixels from Result 2 Or How can we make possible that the blend appear on the shoulders of the shirt using transparent shirt image.

Thanks
Mahak

User avatar
fmw42
Posts: 23845
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 » 2012-08-15T21:29:05-07:00

Make the background under the transparent part of the body image black, then do the same composite.


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

Image

pratik123
Posts: 10
Joined: 2014-04-07T03:35:04-07:00
Authentication code: 6789

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

Post by pratik123 » 2014-04-07T03:43:42-07:00

Hi fmw42
can you please help me for body part
i want exatly this type of body image
http://dappermen.com/media/swatches/shi ... 2_0005.png
but i try more time but not succes
This is my image
http://oi58.tinypic.com/etb2bm.jpg

I use this code
exec('
convert main.png -background black -alpha background main1.png
convert pattern.png \
\( main1.png -blur "0x3" -auto-level \) -alpha set -virtual-pixel transparent \
-compose displace -set option:compose:args "-20x-20" -composite 1displace_body.png
convert 1displace_body.png main.png -compose multiply -composite 1body_dispplace_composite.png
');

Can you please help me.

Thank you

User avatar
fmw42
Posts: 23845
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 » 2014-04-07T10:04:02-07:00

You cannot put multiple convert commands in one exec() command. You need to separate the convert commands and put them each in their own exec() command.

pratik123
Posts: 10
Joined: 2014-04-07T03:35:04-07:00
Authentication code: 6789

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

Post by pratik123 » 2014-04-07T21:52:05-07:00

Hi
I try to using different exec command but not success yet a am using following command

exec("convert pattern.png \
\( clone_7.png -blur 0x3 -auto-level \) -alpha set -virtual-pixel transparent \
-compose displace -set option:compose:args -20x-20 -composite displace_body.png ");
exec(" convert displace_body.png pattern.png -compose multiply -composite final_displace_body.png ");

This is my image
http://s4.postimg.org/5drq16kb1/clone_7.png
I want look like
http://dappermen.com/media/swatches/shi ... 2_0005.png

Thanks in advance

User avatar
fmw42
Posts: 23845
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 » 2014-04-07T22:45:58-07:00

Removing a distortion is very hard if you do not know how it was distorted. I do not know how to do that.

pratik123
Posts: 10
Joined: 2014-04-07T03:35:04-07:00
Authentication code: 6789

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

Post by pratik123 » 2014-04-07T23:25:57-07:00

Thank you for help i do it and its work.

Regarding
Pratik

Post Reply