-(void) UIImage_Merging_two_images{
    
    UIImage *bottomImage = [UIImage imageNamed:@"a1.png"]; //background image
    UIImage *image       = [UIImage imageNamed:@"a2.png"]; //foreground image
    
    CGSize newSize = CGSizeMake(320, 480);
    UIGraphicsBeginImageContext( newSize );
    
    // Use existing opacity as is
    [bottomImage drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
    
    // Apply supplied opacity if applicable
    [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height) blendMode:kCGBlendModeNormal alpha:1];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    
    UIGraphicsEndImageContext();
    
    UIImageView* resultView = [[UIImageView alloc] initWithImage:newImage];
    resultView.frame = CGRectMake(0, 0,320,460);
    [self.view addSubview:resultView];
    
}

By admin-powenko

Dr. Powen Ko is a teacher and CEO on LoopTek LLC, and like to teaching. if you need to class, please let PowenKo know, he will love to service and sharing. LoopTek web site is www.looptek.com

Leave a Reply