Page 1 of 1

image composition problem

Posted: 2011-05-05T03:22:15-07:00
by eugenem
What I need is to apply radial crop + blur + resize to person picture:
Image

and put it on top of background (fixed size):
Image

to get such effect:
Image

I've tried vignette, but it has few problems: it makes black background in central part of the image (even when overall bg is transparent) and also it enlarges image size in unpredictable way.

ImageMagick 6.6.2 on linux

Thanks in advance!

Re: image composition problem

Posted: 2011-05-05T09:38:36-07:00
by fmw42
try this

# first line gets size of person.png image
# second line reads bg.png image
# third line resizes persone.png image and brightens it using -contrast-stretch (you can also try -brightness-contrast)
# fourth line creates a radial-gradient and decreases the effective radius using -level
# fifth line puts the radial gradient into the alpha channel of the resized person.png image to achieve a vignette effect with transparency
# sixth line composites the modified person image over the background and adjusts its position relative to the center

dim=`convert person.png -format "%wx%h" info:`
convert bg.png \
\( \( person.png -resize 90% -contrast-stretch 0,5% \) \
\( -size $dim radial-gradient: -level 10,100% \) \
-compose copy_opacity -composite \) \
-gravity center -geometry -5-5 -compose over -composite person_on_bg.png

Image

Re: image composition problem

Posted: 2011-05-09T04:09:46-07:00
by eugenem
Thanks, Fred! You're the best )