Merge Two Image on to one Image programmatically in iphone

前端 未结 10 819
旧巷少年郎
旧巷少年郎 2020-12-04 17:01

Hello I am developing the application which requires to merge two Image , My image size are 320*240 by merging both Image I want the size to be 320 * 480 . How can i do this

10条回答
  •  一整个雨季
    2020-12-04 17:50

     UIImage *Image1 = [[UIImage alloc] initWithData:data]; 
     UIImage *Image2 = [[UIImage alloc] initWithData:data]; 
     // Set up width height with values.
            CGSize newSize = CGSizeMake(width, height);
            UIGraphicsBeginImageContext( newSize );
    
            [Image1 drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
    
            [Image2 drawInRect:CGRectMake(newSize.width,newSize.height,newSize.width,newSize.height*2) blendMode:kCGBlendModeNormal alpha:1.0];
    
            UIImage *mergedImage = UIGraphicsGetImageFromCurrentImageContext();
    
            UIGraphicsEndImageContext();
    

提交回复
热议问题