![[Cocoa]_[初级]_[Cocoa中对GIF动画分解成一帧帧的图片],第1张 [Cocoa]_[初级]_[Cocoa中对GIF动画分解成一帧帧的图片],第1张](/aiimages/%5BCocoa%5D_%5B%E5%88%9D%E7%BA%A7%5D_%5BCocoa%E4%B8%AD%E5%AF%B9GIF%E5%8A%A8%E7%94%BB%E5%88%86%E8%A7%A3%E6%88%90%E4%B8%80%E5%B8%A7%E5%B8%A7%E7%9A%84%E5%9B%BE%E7%89%87%5D.png)
-(voID) sepatateGifAnimation:(NSImage *) gifImage{ NSArray * reps = [gifImage representations]; for (NSImageRep * rep in reps) { // find the bitmap representation if ([rep isKindOfClass:[NSBitmAPImageRep class]] == NO) continue; // get the bitmap representation NSBitmAPImageRep * bitmapRep = (NSBitmAPImageRep *)rep; // check multiframe gif int numFrame = [[bitmapRep valueForProperty:NSImageFrameCount] intValue]; if (numFrame == 0) break; for (int i = 0; i < numFrame; ++i) { // set the current frame [bitmapRep setProperty:NSImageCurrentFrame withValue:[NSNumber numberWithInt:i]]; NSData *repData = [bitmapRep representationUsingType:NSPNGfileType propertIEs:nil]; [repData writetofile:[Nsstring stringWithFormat: @"/Users/mac-d1/work/UnTitled13_%02d.png",i] atomically:NO]; // NSImage *image = [[NSImage alloc] initWithData:repData];//NSData to NSImage 转化生成NSImage进行其他的 *** 作。 } } 总结 以上是内存溢出为你收集整理的[Cocoa]_[初级]_[Cocoa中对GIF动画分解成一帧帧的图片]全部内容,希望文章能够帮你解决[Cocoa]_[初级]_[Cocoa中对GIF动画分解成一帧帧的图片]所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)