Page 1 of 3

Copy color from source image

Posted: 2012-01-08T00:13:44-07:00
by agriz
Hi

I have two images.
One is very old image (poster)

Now I have to dynamically attach another image in that old image.
But i want the second image to merge with the old poster image.

for example
Image

I tried something like this.

Code: Select all

convert image.png -colorspace gray -sigmoidal-contrast 10,40%  -fill "#d6c39b" copy_portion.png -compose Hardlight  -composite  output.png);
But it is not matching properly with the original image.

copy_portion.png 200*200 #d6c39b colored image.

Re: Copy color from source image

Posted: 2012-01-08T12:26:16-07:00
by fmw42
I think you will need to post a link to your two images and then explain your concept for blending. I am also not sure why you are doing a sigmoidal contrast adjustment in colorspace gray?

Re: Copy color from source image

Posted: 2012-01-08T19:57:46-07:00
by agriz
I have added the image.
Now, If we have a color photo of any person, How do i merge that photo with banner?

I used the above command with the following two pic.
Image
Image

Re: Copy color from source image

Posted: 2012-01-08T20:50:51-07:00
by fmw42
I am sorry, I still don't understand how or where you want to put the constant color image in the larger image? Can you clarify further, please?

Do you have any other examples that show the input and the result you want to achieve?

Re: Copy color from source image

Posted: 2012-01-08T21:00:11-07:00
by agriz
I don't have files on my hand. I am just learning. That is why asked.
http://photofunia.com/effects/wanted_poster

I am looking to learn something like this.
Here, Even if i upload a color photo, It merges with the banner.

How to do such a effect using imagemagick?

Re: Copy color from source image

Posted: 2012-01-08T21:20:53-07:00
by fmw42
try something like this:

convert \( 400424.jpg -brightness-contrast -40,30 \) pic2.png -gravity west -geometry +20+0 -compose over -composite 400424_comp.png


Is that what you want to do?

Re: Copy color from source image

Posted: 2012-01-08T21:38:21-07:00
by agriz

Code: Select all

exec("/usr/bin/convert \( banner322.png -brightness-contrast -40,30 \) 6294644895_caba4c5e85_b.jpg -gravity west -geometry +20+0 -compose over -composite user_uploads/fb_friends/400424_comp.png");
I didn't get any output.

Re: Copy color from source image

Posted: 2012-01-08T22:20:38-07:00
by fmw42
agriz wrote:

Code: Select all

exec("/usr/bin/convert \( banner322.png -brightness-contrast -40,30 \) 6294644895_caba4c5e85_b.jpg -gravity west -geometry +20+0 -compose over -composite user_uploads/fb_friends/400424_comp.png");
I didn't get any output.

I don't know that much about PHP, but you may have conflicts with unquoted parentheses. Are your sure your PHP is working with IM? What do you get from

exec("/usr/bin/convert -version");


Here is my result.


Image

Is this what you are trying to achieve?

Re: Copy color from source image

Posted: 2012-01-08T22:23:20-07:00
by agriz
6.7.4-0
and
6.5.4-7

I have these two versions in two computers

Re: Copy color from source image

Posted: 2012-01-08T22:26:51-07:00
by fmw42
try

exec("/usr/bin/convert banner322.png -brightness-contrast -40,30 6294644895_caba4c5e85_b.jpg -gravity west -geometry +20+0 -compose over -composite user_uploads/fb_friends/400424_comp.png");

Otherwise, it might be directories or permissions on the directories.

User Bonzo can probably help you further with your PHP exec command, when he gets online. You might get some clues by looking at his website as he codes in PHP exec. See http://www.rubblewebs.co.uk/index.php

Re: Copy color from source image

Posted: 2012-01-08T22:29:06-07:00
by fmw42
agriz wrote:6.7.4-0
and
6.5.4-7

I have these two versions in two computers
I presume that you do not have multiple versions on the same computer!

Re: Copy color from source image

Posted: 2012-01-08T22:30:02-07:00
by agriz
I got it working!. :)
But Image is not merged with the banner color.

Re: Copy color from source image

Posted: 2012-01-08T22:35:35-07:00
by fmw42
agriz wrote:I got it working!. :)
But Image is not merged with the banner color.

I am not sure what you mean. See my result above and tell me if that is what you want and what you get? If that is not what you want, please explain why it is not or what you want changed about my example.

Is this more what you want?


convert 400424.jpg pic2.png -gravity west -geometry +20+0 -compose over -composite 400424_comp2.png

Image

Re: Copy color from source image

Posted: 2012-01-08T22:43:51-07:00
by agriz
Sorry. You are right. I got it working.

Code: Select all

convert \( 400424.jpg -brightness-contrast -40,30 \) pic2.png -gravity west -geometry +20+0 -compose over -composite 400424_comp.png
I am confused with the image names.
Thank you!!! :)

Re: Copy color from source image

Posted: 2012-01-08T22:46:08-07:00
by fmw42
I renamed your image above from 400424_324213737601333_113544412001601_1056022_1484520050_n.jpg to 400424.jpg because it was too long for me to use. Your other image (the constant color) was kept the same as pic2.png. See your image names from the two your presented at the top.


You can also do something similar to my last example with


convert 400424.jpg -fill "#F7EDD4" -draw "rectangle 20,20 140,140" 400424_f7edd4.png


I really need to understand better what you are trying to do, if my examples are not what you want!