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

Re: Copy color from source image

Post by agriz »

I am now trying with different images.
-brightness-contrast -40,30 -- I think, this is the keyword and important to merge the images.

I will upload what i got for different images.
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 am now trying with different images.
-brightness-contrast -40,30 -- I think, this is the keyword and important to merge the images.

I will upload what i got for different images.

-brightness-contrast does not affect merging images, all it does is change how bright or how much contrast you have in your background image.


See my other examples that followed without the -brightness-contrast. Tell me what it is that you want to do that is different from any or all of my examples above.


What is your current php command?
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: Copy color from source image

Post by agriz »

second example is just merging.
I want the first example.

If i upload my photo, then, it should be merged with that poster and should look like little old poster
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:second example is just merging.
I want the first example.

If i upload my photo, then, it should be merged with that poster and should look like little old poster

Are you getting what you want now? If not, what is your current command?


see
http://www.imagemagick.org/script/comma ... s-contrast
http://www.imagemagick.org/Usage/color_mods/
http://www.imagemagick.org/Usage/layers/#convert
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: Copy color from source image

Post by agriz »

First example is working for few images.
For some other images, i am not exactly getting the result.

I will try this now "-sigmoidal-contrast 10,50%"
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Copy color from source image

Post by anthony »

Starting at basics....

You mentioned you have a color photo you want to make look like it matches the old poster.

Hmmm I would look at the poster and try to work out the average darkest (text), and lightest (background) color and use that as as tinting gradent for a black and white version of the photo.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: Copy color from source image

Post by agriz »

Image

This is my exact need.
I was trying lot. But This picture explains what i am exactly looking.
I want to replace the photo in the heart.

Another one is

Image
I want to composite a photo in the middle of the heart, But the photo should mingle with the heart's color.

Image
This is not correct. Because the photo is not mingled with the original image.

Image
This one is good. it is mingled with the original photo.
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 »

You need to create a feathered alpha channel on the overlay image before compositing. Post a link to your two separate input images that you want to combine and we can show you how to do that.

Below I cropped the girl image from your composite, then did the following:


convert zmy23k.png hva0p0_crop.png \
\( -clone 1 -fill white -colorize 100% -virtual-pixel black -blur 0x20 -auto-level -level 50x100% \) \
\( -clone 1 -clone 2 -alpha off -compose copy_opacity -composite \) \
-delete 1,2 -gravity center -geometry +0-30 -compose over -composite zmy23k_hva0p0_comp.png

Image


You can adjust the blur amount from 20 to some other value to get different vignetting effects.
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: Copy color from source image

Post by agriz »

I tried your script.
But it didn't work

That is the right image.
That girl image can be anything.

I tried this code

Code: Select all

/usr/bin/convert zmy23k.png hva0p0_crop.jpg \( -clone 1 -fill white -colorize 100% -virtual-pixel black -blur 0x20 -auto-level -level 50x100% \) \( -clone 1 -clone 2 -alpha off -compose copy_opacity -composite \) -delete 1,2 -gravity center -geometry +0-30 -compose over -composite zmy23k_hva0p0_comp.png
I used an jpg image instead of that png
I am using imagemagick version 6.7.4-0 (This is windows)

@6.5.4-7 (This is linux)
I got this following error.
unrecognized option `-auto-level'
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 »

Your linux version of IM is too old for -auto-level. Replace it with -contrast-stretch 0

Also windows syntax is different. You must remove the \ with the parens and change % to %%. Also the end of line \ needs to be changed to ^

see
http://www.imagemagick.org/Usage/windows/
Last edited by fmw42 on 2012-02-18T10:36:22-07:00, edited 1 time 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 »

I used yum install ImageMagick on my fedora.
How to get the latest version?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Copy color from source image

Post by magick »

Try this:
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: Copy color from source image

Post by agriz »

Will it install in the /usr/bin/ ?
Or do i need to configure the path during the install?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Copy color from source image

Post by magick »

By default it installs in /usr/local.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Copy color from source image

Post by anthony »

I recommend a package install of IM under fedora -- I do this all the time...
Packages make it cleaner to install and upgrade.

See my notes in..
http://www.imagemagick.org/Usage/api/#rpms

However if you want a non-system (personal) version, look at the section further down
http://www.imagemagick.org/Usage/api/#personal

A have 3 'personal' versions I pick an choose from as part of my development work.
Personal versions does not interfere with other programs that may use ImageMagick. (such as the "Calibre" E-book reader)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply