Copy color from source image

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?".
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Copy color from source image

Post 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.
Last edited by agriz on 2012-01-08T19:54:16-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Copy color from source image

Post 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?
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: Copy color from source image

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

Re: Copy color from source image

Post 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?
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: Copy color from source image

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

Re: Copy color from source image

Post 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?
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: Copy color from source image

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

Re: Copy color from source image

Post 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?
Last edited by fmw42 on 2012-01-08T22:24:23-07:00, edited 3 times in total.
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: Copy color from source image

Post by agriz »

6.7.4-0
and
6.5.4-7

I have these two versions in two computers
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Copy color from source image

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

Re: Copy color from source image

Post 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!
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: Copy color from source image

Post by agriz »

I got it working!. :)
But Image is not merged with the banner color.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Copy color from source image

Post 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
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: Copy color from source image

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

Re: Copy color from source image

Post 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!
Post Reply