Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create own mask in ios

enter image description here

Duplicate

so don't negative my reputation.

My mask image is : enter image description here

My output is : enter image description here

- (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...

like image 590
Mani Avatar asked Jun 12 '12 07:06

Mani


People also ask

How to set up Face ID with a mask on iPhone?

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.

How to unlock iPhone with Apple Watch with face mask?

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.

How can I improve the accuracy of Face ID with a mask?

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.

How do you change the color of a mask in Minecraft?

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.


Video Answer


1 Answers

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.

enter image description here

like image 152
Rok Jarc Avatar answered Sep 29 '22 01:09

Rok Jarc