IOS How to merge image

+ (UIImage*)mergeImage:(UIImage*)first withImage:(UIImage*)second atPoint:(CGPoint) point {
   
    CGSize firstSize = first.size;
    CGSize secondSize = second.size;
    CGSize mergedSize = CGSizeMake(MAX(firstSize.width, secondSize.width),
                                   MAX(firstSize.height, secondSize.height));
    CGFloat mergedScale = MAX(first.scale, second.scale);
   
    UIGraphicsBeginImageContextWithOptions(mergedSize, NO, mergedScale);
   
    [first drawAtPoint:CGPointZero];
    [second drawAtPoint:point];
   
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
   
    return newImage;
}

Comments

Popular posts from this blog

Java : Variables Declaring

Install DNF in RHEL/CentOS 7

SQL Self JOIN