image composition problem

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
eugenem
Posts: 2
Joined: 2011-05-05T02:58:56-07:00
Authentication code: 8675308

image composition problem

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

Re: image composition problem

Post 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
eugenem
Posts: 2
Joined: 2011-05-05T02:58:56-07:00
Authentication code: 8675308

Re: image composition problem

Post by eugenem »

Thanks, Fred! You're the best )
Post Reply