Duplicate
so don't negative my reputation.
My mask image is :
My output is :
- (UIImage*)maskImage:(UIImage *)image withMask:(UIImage *)maskImage {
CGImageRef maskRef = maskImage.CGImage;
CGImageRef mask = CGImageMaskCreate(
CGImageGetWidth(maskRef),
CGImageGetHeight(maskRef),
CGImageGetBitsPerComponent(maskRef),
CGImageGetBitsPerPixel(maskRef),
CGImageGetBytesPerRow(maskRef),
CGImageGetDataProvider(maskRef), NULL, false
);
CGImageRef masked = CGImageCreateWithMask(image.CGImage, mask);
CGImageRelease(mask);
return [UIImage imageWithCGImage:masked];
}
So how to create my own mask image?
Thanks...
We set up Face ID with a Mask on an iPhone 12 Pro Max running iOS 15.4 Tap Settings > Face ID & Passcode. Then enter your Passcode to enter. As Apple says, you won’t need to wear a mask during setup.
Follow the onscreen instructions to set up Face ID using the same face scan process. You can also unlock your iPhone with your Apple Watch while wearing a mask. If you wear a face mask too high or too close to your eyes, your iPhone may fail to unlock with Face ID. This feature requires your eyes to be unblocked.
If you wear glasses, you can improve the accuracy of Face ID with a mask by setting it up with your glasses on. You can do this when you first set up Face ID or later. You can add up to four pairs of glasses with Face ID. Open the Settings app, then tap Face ID & Passcode. Scroll down and tap Add Glasses.
Type in Screen Tap and then select “Add Patch”. Let’s add more nodes, like a Counter and an Option Picker. In Option Picker, click the gear icon on the bottom and select Color from the drop down. Let’s choose 5 different colors for your mask and enable the user to tap to swap them.
Try converting image to a grayscale image without alpha.
Save it as .jpg to remove alpha. Then you can save it back to png. This image should work already.
Convert it to greyscale (since color information is discarded in this kind of masking) by image->mode->greyscale.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With