What I need is to apply radial crop + blur + resize to person picture:
and put it on top of background (fixed size):
to get such effect:
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!
image composition problem
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: image composition problem
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
# 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
Re: image composition problem
Thanks, Fred! You're the best )