Page 1 of 1

overlaying 2 images partly

Posted: 2014-01-27T14:09:33-07:00
by blurringme
I am trying to overlap two images with imagemagick. I have enclosed 2 images radar1.png and radar2.png.

Now the trick is that radar1.png needs to go over radar2.png. When I do this with:
composite radar1.png radar2.png radarend.png
the image is overlayd but you can see that they do not blend nice together. On the border areas of the radar2.png image I would like to get a blended section. In the radarendred.png I marked by hand the areas I mean. This effect can happen in the whole border/overlapping area. In those areas where there is no overlap I want to retain the original colors. Is there a way to blend the colours of the two images in a way that those border areas are more smooth brought together.

The data can be found on http://www.dhrvc.nl/samples.zip

I hope you can help.

Kind regards
Stefan

Re: overlaying 2 images partly

Posted: 2014-01-27T14:53:47-07:00
by fmw42
Assuming you alpha channels are binary, apply a slight blur to the alpha channels to smooth the blending at the edges of the two regions before compositing (or at least the alpha channel of the top image). try


convert background \( foreground -alpha on -channel a -blur 0x1 +channel \) -compose over -composite result

increase the blur if needed or desired. The above is unix syntax. On Windows


convert background ( foreground -alpha on -channel a -blur 0x1 +channel ) -compose over -composite result

Re: overlaying 2 images partly

Posted: 2014-01-27T23:42:18-07:00
by blurringme
You mean like this?
composite radar1.png ( foreground -alpha on -channel a -blur 0x1 +channel ) -compose over -composite radar3.png
It gives errors on the images. So input is radar1.png and my output name is radar3.png. I think I am misunderstanding your syntax.


Regards
Stefan

Re: overlaying 2 images partly

Posted: 2014-01-27T23:47:32-07:00
by fmw42
composite radar1.png ( foreground -alpha on -channel a -blur 0x1 +channel ) -compose over -composite radar3.png
That should be

convert radar2.png ( radar1.png -alpha on -channel a -blur 0x1 +channel ) -compose over -composite radar3.png

where I am using the convert syntax, which is more current and more flexible. Note the order of the two images is reversed in convert syntax.

see
http://www.imagemagick.org/Usage/compose/#compose