Page 1 of 3
apply curv to image
Posted: 2016-04-18T13:20:45-07:00
by vinod
hi i have vertical line image / fabric image , i want to apply that image on sleeve , but it appear straight whereas it would have curvy so how to apply curv to that image ? any idea ?
My line image / fabric
sleeve image
Expected
Kindly Help me coz i am very near to result. .
Re: apply curv to image
Posted: 2016-04-18T14:03:43-07:00
by Bonzo
There are posts about this exact same question on the forum and I would try a search.
EDIT: This is probably the post you need:
viewtopic.php?f=1&t=23348&hilit=shirt
Re: apply curv to image
Posted: 2016-04-18T15:32:24-07:00
by fmw42
Where is your code? How can we advise without seeing that. Also always provide your IM version and platform, since syntax differs.
Re: apply curv to image
Posted: 2016-04-18T15:46:16-07:00
by fmw42
You have two issues that I see in your command and data from your PM to me:
1) your sleeve needs an adjustment in brightness and contrast
2) your stripe pattern is too coarse (stripes too far apart)
You can fix the second by appending the image to itself in both directions and scaling down the original size.
This is unix code.
Code: Select all
convert \( sleeve.png -brightness-contrast -10,20 \) \
\( line1.jpg +duplicate -append +duplicate +append -scale 50% \) \
\( -clone 0 \) \
\( -clone 1 -clone 0 -virtual-pixel transparent \
-compose displace -set option:compose:args -15x-15 -composite \) \
-delete 0,1 -compose multiply -composite line1_sleeve_result.png
I believe the following is Windows syntax.
Code: Select all
convert ( sleeve.png -brightness-contrast -10,20 ) ^
( line1.jpg +duplicate -append +duplicate +append -scale 50% ) ^
( -clone 0 ) ^
( -clone 1 -clone 0 -virtual-pixel transparent ^
-compose displace -set option:compose:args -15x-15 -composite ) ^
-delete 0,1 -compose multiply -composite line1_sleeve_result.png
NOTE: you will get a slightly different pattern using 15x15 than with -15x-15 and the same as the former using 15x1.
You cannot bend the pattern on the sleeve unless you add other distortion images to cause the bend. See
viewtopic.php?f=1&t=23348&hilit=shirt#p98071 and further down about bending.
Re: apply curv to image
Posted: 2016-04-21T06:38:33-07:00
by vinod
Thanks for your replay sir,
by applying this command
$cmd1 = "convert $source_image ( -clone 0 -auto-level -alpha off $fabric_image -virtual-pixel transparent -compose multiply -composite ) -compose SrcIn -composite $dest_image";
and over lap mask images on each other...
i am getting result as
&
by applying this command
$cmd1 = "convert ( $source_image -brightness-contrast -10,20 ) ( $fabric_image +duplicate -append +duplicate +append -scale 50% ) ( -clone 0 ) ( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args 15x15 -composite ) -delete 0,1 -compose multiply -composite $dest_image";
and over lap mask images on each other...
i am getting result as
in the last one -scale 50% makes some good result but it reflects
1) white border around images as you can see
2) depth is missed which comes by -auto-level
so what changes need to do in following command so i will not get much dark image by -auto-level and white borders will not come
$cmd1 = "convert ( $source_image -brightness-contrast -10,20 ) ( $fabric_image +duplicate -append +duplicate +append -scale 50% ) ( -clone 0 ) ( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args 15x15 -composite ) -delete 0,1 -compose multiply -composite $dest_image";
Thanks.
Kindly replay.
Re: apply curv to image
Posted: 2016-04-21T09:33:45-07:00
by fmw42
Sorry we do not understand what you are trying to do. Please post your input images along with the output.
Re: apply curv to image
Posted: 2016-04-23T15:08:36-07:00
by vinod
sir,
near about my issue is getting solved i got scaled pattern image from normal pattern image by this your command
convert brown_checks.jpg +duplicate -append +duplicate +append -scale 50% brown_checks2.jpg
normal pattern image
my scale image
thanks for this...
only in above command i want to add "displace -set option:compose:args 15x15"
how to set the command for this ?
Re: apply curv to image
Posted: 2016-04-23T15:16:17-07:00
by fmw42
You have not posted all your input images. Please show us all your images, so we can test what you are doing. Also post your exact command lines.
see
viewtopic.php?f=1&t=9620
Re: apply curv to image
Posted: 2016-04-23T15:30:20-07:00
by vinod
sir this is my input images
2.png
3.png
4.png
brown_checks.jpg
by this command
convert brown_checks.jpg +duplicate -append +duplicate +append -scale 50% brown_checks2.jpg
i got -scale image
brown_checks2.jpg
so that image i will apply on 2.png,3.png,4.png by this command
convert 2.png ( -clone 0 -auto-level -alpha off brown_checks2.jpg -virtual-pixel transparent -compose multiply -composite ) -compose SrcIn -composite 2_temp.png
convert 3.png ( -clone 0 -auto-level -alpha off brown_checks2.jpg -virtual-pixel transparent -compose multiply -composite ) -compose SrcIn -composite 3_temp.png
convert 4.png ( -clone 0 -auto-level -alpha off brown_checks2.jpg -virtual-pixel transparent -compose multiply -composite ) -compose SrcIn -composite 4_temp.png
thanks for this...
now only in
"convert brown_checks.jpg +duplicate -append +duplicate +append -scale 50% brown_checks2.jpg" this command i want to add
"displace -set option:compose:args 15x15"
how to set the command for this ? / how to add this in "convert brown_checks.jpg +duplicate -append +duplicate +append -scale 50% brown_checks2.jpg" this command ?
please replay. .
Re: apply curv to image
Posted: 2016-04-23T15:48:59-07:00
by fmw42
Your white lines in the middle come from your input images. If you composite them together, you will see the lines.
Code: Select all
convert 2.png 3.png 4.png -background none -flatten 234.png
However, in your code you use -auto-level on each one separately.
We can do something similar as
Code: Select all
convert 2.png 3.png 4.png -auto-level -background none -flatten 234b.png
If we do your processing separately on each image as follows, we get
Code: Select all
convert 2.png -auto-level \
\( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% \) \
\( -clone 0 \) \
\( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args 15x15 -composite \) \
-delete 0,1 -compose multiply -composite result2.png
convert 3.png -auto-level \
\( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% \) \
\( -clone 0 \) \
\( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args 15x15 -composite \) \
-delete 0,1 -compose multiply -composite result3.png
convert 4.png -auto-level \
\( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% \) \
\( -clone 0 \) \
\( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args 15x15 -composite \) \
-delete 0,1 -compose multiply -composite result4.png
convert result2.png result3.png result4.png -background none -flatten result_2_3_4.png
If we do it all combined, we get something similar.
Code: Select all
convert 2.png 3.png 4.png -auto-level -background none -flatten \
\( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% \) \
\( -clone 0 \) \
\( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args 15x15 -composite \) \
-delete 0,1 -compose multiply -composite result234.png
If you want white buttons, then you will need to make an image of only the buttons on a transparent background and then composite it over the results above.
EDIT:
If you do not want the white lines, remove the -auto-level. But it looks too flat for me.
Code: Select all
convert 2.png 3.png 4.png -background none -flatten -brightness-contrast -20,20 \
\( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% \) \
\( -clone 0 \) \
\( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args 15x15 -composite \) \
-delete 0,1 -compose multiply -composite result234b.png
Re: apply curv to image
Posted: 2016-04-23T16:04:47-07:00
by fmw42
Just a note:
I had used the following to modify the texture image
Code: Select all
convert brown_checks.jpg +duplicate -append +duplicate +append -scale 50% brown_checks2a.jpg
This was a quick and dirty approach and worked OK, but may have the tendency to show discontinuities. A better method is
Code: Select all
convert brown_checks.jpg \( +clone -flip \) -append \( +clone -flop \) +append -scale 50% brown_checks2b.jpg
Re: apply curv to image
Posted: 2016-04-24T08:56:23-07:00
by vinod
now the time my problem has solved. . . thanks so much for suggestion. . .
only cylinder issues is remain .. i am working for this and will ask you for sure. very soon. . thanks so much .. again. . fred. .
Re: apply curv to image
Posted: 2016-04-24T11:40:27-07:00
by vinod
sir,
you have given this command
command 1) "convert brown_checks.jpg \( +clone -flip \) -append \( +clone -flop \) +append -scale 50% brown_checks2b.jpg"
and this is my command
command 2) "convert source.png ( -clone 0 -level 50%,100% -alpha off fabric.png -virtual-pixel transparent -compose multiply -composite ) -compose SrcIn -composite output.png"
both command works fine no problems.. but i want to add "displace -set option:compose:args -15x1" in above commands how to add it properly basically in 1st command ?
please help
Re: apply curv to image
Posted: 2016-04-24T13:41:50-07:00
by fmw42
I do not know what you are trying to do. You need to explain in more detail with images provided and what you have tried.
Best guess is what we have done above:
Code: Select all
convert source.png \
\( brown_checks.jpg \( +clone -flip \) -append \( +clone -flop \) +append -scale 50% \) \
\( -clone 0 \) \
\( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args 15x15 -composite \) \
-delete 0,1 -compose multiply -composite result.png
You should review the use of parenthesis processing. See
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/basics/#clone
Re: apply curv to image
Posted: 2016-04-25T02:16:35-07:00
by vinod
dear sir,
script is perfect as i want but still i have following things to do in it that
mask.png -
red.png -
convert mask.png -level 50%,100% -background none -flatten ( red.png +duplicate -append +duplicate +append -scale 50% ) ( -clone 0 ) ( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args -5x1 -composite ) -delete 0,1 -compose multiply -composite 2.png
this gives me
2.png -
and i want 1.png
see 2.png again plz , the black mark portion
i want that to be like in the image 1.png. . but in 2.png it look flat.. how can i give effect to it ? like in image 1.png