mask image:
base image:
I want to make the base image into a circle with this mask image
version: IM-7
How to composite image with a mask
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to composite image with a mask
You did not say which OS you are using nor the exact IM version. Assuming Unix (Linux or Mac OSX), try either
For Windows, remove all the \
Code: Select all
magick base.jpg -set option:dims "%wx%h" \( mask.png -alpha extract -resize 200% -size "%[dims]" xc:white +swap -gravity center -geometry -20-20 -alpha off -compose copy_opacity -composite \) +geometry -compose over -composite result1.png
magick base.jpg -set option:dims "%wx%h" \( mask.png -alpha extract -resize 200% -size "%[dims]" xc:white +swap -gravity center -geometry -20-20 -alpha off -compose copy_opacity -composite \) +geometry -compose over -composite -trim +repage result2.png