1 | initial version |
Make sure when you read the mask image in that you keep the fourth channel. Then threshold that to get a binary mask that is only the opaque parts. Once you resize the mask image, extract the fourth channel and use it as the mask parameter in the copyTo function. This will prevent it from copying the parts that are transparent.