imagick - create an irregular-shaped crop

how to create an image whick is filled with pieces of irregular-shaped images, it’s a good practice for me to handle it.

result

logo

principle

logo

bash

1
2
3
4
5
6
7
#!/bin/bash
input=$1 # source image
mask=$2 # mask image
output=$3 # target image
convert ${input} ${mask} -gravity Center -alpha Off -compose CopyOpacity -composite ${output}

summary

1
you can use a programming language (php,java...) whick use the imagck api to implement it.