Authoryogita.balganure

Change color of image to transparent

C

CGImageRef rawImageRef = image.CGImage; const double colorMasking[6] = { 0, 0, 0, 0, 0, 0 }; UIGraphicsBeginImageContext(image.size);   CGImageRef maskedImageRef =  CGImageCreateWithMaskingColors(rawImageRef, colorMasking); { CGContextTranslateCTM(UIGraphicsGetCurrentContext(), 0.0, image.size.height); CGContextScaleCTM(UIGraphicsGetCurrentContext(), 1.0, -1.0); }  ...

Merge two images by retaining opacity of Image

M

UIGraphicsBeginImageContext(topImage.size);   CGContextRef context = UIGraphicsGetCurrentContext(); CGContextTranslateCTM(context, 0, topImage.size.height); CGContextScaleCTM(context, 1.0, -1.0); CGRect rect = CGRectMake(0, 0, topImage.size.width, topImage.size.height); // draw black background to preserve color of transparent pixels CGContextSetBlendMode(context, kCGBlendModeNormal);...

Category