Objective c 分割一个大图像以供纹理使用

Objective c 分割一个大图像以供纹理使用,objective-c,ios,cocoa-touch,Objective C,Ios,Cocoa Touch,我需要将一个大图像(大约10000px的高度)分割成一些较小的图像,以便将它们用作OpenGL的纹理,下面是我现在的操作方式,任何人都有加快操作速度的想法,因为这需要很长时间 NSArray *images = [NSArray alloc] initWith for (int i = 0; i<numberOfImages; i++){ int t = i*origHeight; CGRect fromRect = CGRectMake(0, t, origWidth

我需要将一个大图像(大约10000px的高度)分割成一些较小的图像,以便将它们用作OpenGL的纹理,下面是我现在的操作方式,任何人都有加快操作速度的想法,因为这需要很长时间

NSArray *images = [NSArray alloc] initWith 
for (int i = 0; i<numberOfImages; i++){

    int t = i*origHeight;
    CGRect fromRect = CGRectMake(0, t, origWidth, origHeight); // or whatever rectangle

    CGImageRef drawImage = CGImageCreateWithImageInRect(sourceImage.CGImage, fromRect);

    UIImage *newImage = [UIImage imageWithData:UIImageJPEGRepresentation([UIImage imageWithCGImage:drawImage],1.0)];

    [images addObject:newImage];

    CGImageRelease(drawImage);
}
NSArray*images=[NSArray alloc]initWith

对于(int i=0;i您可以在ie之前使用
convert
命令预拆分它们,您可以使用