- (CGImageRef) newMaskFromImage: (UIImage *) image { CGImageRef maskRef = image.CGImage; CGImageRef mask2 = CGImageMaskCreate (CGImageGetWidth (maskRef), CGImageGetHeight (maskRef), CGImageGetBitsPerComponent (maskRef), CGImageGetBitsPerPixel (maskRef), CGImageGetBytesPerRow (maskRef), CGImageGetDataProvider (maskRef), NULL, NO); // provider, shouldInterpolate return mask2; } // newMaskFromImage