组合多个图像以获得单个图像

问题描述:

我已经捕捉UIView的内容。有很多方法来捕捉内容。
问题是,,如果视图的大小变得过大,应用程序崩溃,因为它需要的内存数量巨大。
所以是否有可能合并的原始图像数据(执行逐字节操作)在单个文件中,使图像从??组合多个图像以获得单个图像

`enter code here`Merging two images to create one single image file 

Suppose we have two images with name file1.png and file2.png The code below merges two images. 

@implementation LandscapeImage 
- (void) createLandscapeImages 
{ 
    CGSize offScreenSize = CGSizeMake(2048, 1380); 
    UIGraphicsBeginImageContext(offScreenSize); 
//Fetch First image and draw in rect 
    UIImage* imageLeft = [UIImage imageNamed:@"file1.png"]; 
    CGRect rect = CGRectMake(0, 0, 1024, 1380); 
    [imageLeft drawInRect:rect]; 
    [imageLeft release]; 

//Fetch second image and draw in rect  
    UIImage* imageRight = [UIImage imageNamed:@"file2.jpg"]; 
    rect.origin.x += 1024; 
    [imageRight drawInRect:rect];  
    [imageRight release]; 

    UIImage* imagez = UIGraphicsGetImageFromCurrentImageContext();// it will returns an image based on the contents of the current bitmap-based graphics context. 
    if (imageLeft && imageRight) 
    { 
    //Write code for save imagez in local cache 
    } 
    UIGraphicsEndImageContext(); 
} 
@end 
+1

这是同一次捕获整个看法。它带来的一切记忆和大规模的看法,内存变成多少来处理。 – 2012-03-13 08:00:15