Invert colors of image with transparent background
问题 I have an uiimage with transparent background. if I invert the colors with the follow method, the transparent background change to white and then to black. I want that it doesnt invert transparent pixels? how can i do that? -(UIImage *) getImageWithInvertedPixelsOfImage:(UIImage *)image { UIGraphicsBeginImageContextWithOptions(image.size, NO, 2); CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeCopy); [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];