0

I am using this method to mask a UIImage:

UIImage *inputImage = [UIImage imageName:@"inputImage.png"];
CGImageRef maskRef = [UIImage imageNamed:@"mask.png"].CGImage; 

CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
                                    CGImageGetHeight(maskRef),
                                    CGImageGetBitsPerComponent(maskRef),
                                    CGImageGetBitsPerPixel(maskRef),
                                    CGImageGetBytesPerRow(maskRef),
                                    CGImageGetDataProvider(maskRef), NULL, false);

CGImageRef masked = CGImageCreateWithMask([inputImage CGImage], mask);
CGImageRelease(mask);

UIImage *maskedImage = [UIImage imageWithCGImage:masked];

CGImageRelease(masked);

This is the mask image:

enter image description here

And the problem is that when I mask the image the border is in black, it is possible to make the border transparent?

ThomasCle
  • 6,792
  • 7
  • 41
  • 81
YosiFZ
  • 7,792
  • 21
  • 114
  • 221
  • possible duplicate of [UIImage masking gives black background on the iPhone (and not in simulator)](http://stackoverflow.com/questions/3297994/uiimage-masking-gives-black-background-on-the-iphone-and-not-in-simulator) – Cyrille Apr 15 '13 at 09:28
  • check this out http://stackoverflow.com/questions/10978847/how-to-smoothen-the-edges-of-a-uiimageview-in-ios – Harish Apr 15 '13 at 09:33
  • Two of this wo'nt work – YosiFZ Apr 15 '13 at 10:42

0 Answers0