0

I'm trying to resize down a GIF image in iOS, so I'm looping thru each frame as you can see in the code below.

    NSMutableArray *animationImages = [NSArray arrayWithArray:sourceImage.images];
    NSMutableArray *newAnimationImages = [[NSMutableArray alloc] init];

    //@autoreleasepool {
        UIGraphicsBeginImageContext(CGSizeMake(newWidth, newHeight));
        for(UIImage *frame in animationImages) {
            [frame drawInRect:CGRectMake(0, 0, newWidth, newHeight)];
            UIImage *newFrame = UIGraphicsGetImageFromCurrentImageContext();
            [newAnimationImages addObject:newFrame];
        }
        UIGraphicsEndImageContext();
    //}

    newImage = [UIImage animatedImageWithImages:newAnimationImages duration:sourceImage.duration];

Unfortunately, for some reason, it's taking ages to resize (around 3-4 seconds for a 2-4 second gif)

Any ideas what I'm doing wrong?

4

1 に答える 1

0

簡単な更新 - UIImageView の Aspect Fit ビュー オプションを使用することになりました。これはまさに必要なことを行い、サーバー側で実際のサイズ変更を行いました。

于 2013-07-27T15:06:45.280 に答える