How do we mingle the photo color to background color?

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

How do we mingle the photo color to background color?

Post by agriz »

I saw this photo/

They have merged the photo color to sand color.
How to achieve this effect?

What is the general idea on this one?
Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How do we mingle the photo color to background color?

Post by snibgo »

Probably: the image of the people in the hearts is entirely black, with varying transparency. This is given a perspective distortion, then composed over the photo of the beach.
snibgo's IM pages: im.snibgo.com
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: How do we mingle the photo color to background color?

Post by agriz »

Apart from transparency and perspective, how do they change the image color to sand color to match it?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How do we mingle the photo color to background color?

Post by snibgo »

If a pixel that is black but 70% transparent is composed over a colour, the result will be a slightly dark version of that colour.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do we mingle the photo color to background color?

Post by fmw42 »

Perhaps you can provide your two input images (or representative examples) and some one can then process them and show you the command line for that. Also please always provide your version of IM and platform, since syntax can vary. See the very top post on the Users forum at viewtopic.php?f=1&t=9620
vinnpro
Posts: 2
Joined: 2016-02-15T16:49:50-07:00
Authentication code: 1151

Re: How do we mingle the photo color to background color?

Post by vinnpro »

Hi Guys, I want to do something similar. I want to merge my text with a background image of beach sand. I am able to complete somewhat following:
Image

Can someone help me to optimize it in php. Quality to achieve is bit.ly/1PFBRtS, which is created in Java.

Thanks
Vin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do we mingle the photo color to background color?

Post by fmw42 »

What is wrong with what you have done? Was it not in Imagemagick? If it was using Imagemagick, you can just put the command line into PHP exec() command.

Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line.

See viewtopic.php?f=1&t=9620
vinnpro
Posts: 2
Joined: 2016-02-15T16:49:50-07:00
Authentication code: 1151

Re: How do we mingle the photo color to background color?

Post by vinnpro »

It is ImageMagik but quality it not as good as on : bit.ly/1PFBRtS . I am using WAMP 2.5 with ImageMagik 3.6 library.

I am using following lines of command:

$picin = new Imagick($inFile);
$picin->scaleimage(800,0);
$height = $picin->getimageheight();

$draw = new ImagickDraw();
$draw->setStrokeColor("#C59157");
$draw->setStrokeFill(1);
$draw->setFillColor('#8C6A45');
$draw->setFontSize(70);
$draw->setStrokeAntialias(false);
$picin->annotateImage($draw,40,$height-50,0,$text_in);
$picin->writeImage($outFile);

Is there any other functions or commands to improve the quality and make it like provide link.

Thanks,
Vinod
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How do we mingle the photo color to background color?

Post by Bonzo »

You are not using Imagemagick directly but going through the Imagick API.

I would say you need to distort your text to make it look like it is flat on the sand and possibly make it slightly transparent to let some of the sand texture through. You might be able to do the transparency by using a rgba colour rather than hex ones.
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: How do we mingle the photo color to background color?

Post by agriz »

snibgo wrote:If a pixel that is black but 70% transparent is composed over a colour, the result will be a slightly dark version of that colour.
I did 30% colorize and changed to gray scale
photo.png was already changed to some perspective using photoshop

beach.png ( photo.png -colorspace Gray -colorize 30% ) -gravity center -compose over -composite result.png
Image

Did not work as expected
Please advice
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do we mingle the photo color to background color?

Post by fmw42 »

If it is not working the way you want, then please explain what you want and why it is not working.

Please always provide your input images and not just the output saying it does not work.

try

Code: Select all

convert beach.png ( photo.png -colorspace Gray ) -gravity center -compose multiply -composite result.png
agriz
Posts: 237
Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308

Re: How do we mingle the photo color to background color?

Post by agriz »

Sir, i posted the result image in the first post. I just found it in some website.
I wanted to try the effect.

I don't know how to give you input images. I just wanted to make the image looks like it was drawn on the beach sand,
Multiply is giving good result.

I will post the code and images i used after changing the perspective.

Sir, you have any idea about perspective? Do we need to make different tries? Or is there any defined procedure for different distort perspective?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do we mingle the photo color to background color?

Post by fmw42 »

See http://www.imagemagick.org/Usage/distorts/#perspective or on Unix system (Linux, Mac OSX or Windows with Cygwin) you can use my 3Drotate script.
I don't know how to give you input images. I just wanted to make the image looks like it was drawn on the beach sand,
Multiply is giving good result.
You can upload your input image for your example the same way you provided the output images. All I am saying is if you have some result you created and it is not working the way you want, you should always provide both the input and output images along with your command line, so that others can test with the actual images and command. And also explain why it is not working the way you want, so we can understand what is the problem.
Post Reply