图片合成GIF
来源:互联网 发布:股票行情软件源码 编辑:程序博客网 时间:2024/04/28 04:48
NSImage *img1 = [NSImage imageNamed:@"Textmate"];NSImage *img2 = [NSImage imageNamed:@"potraint"];NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"];NSLog(@"%@", path);NSURL *destUrl = [NSURL fileURLWithPath:path];CGImageDestinationRef imageDest;NSString *uti = @"com.compuserve.gif";NSData *img1Data = [img1 TIFFRepresentation];NSData *img2Data = [img2 TIFFRepresentation];NSDictionary *frameProperties = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:2] forKey:(NSString *)kCGImagePropertyGIFDelayTime] forKey:(NSString *)kCGImagePropertyGIFDictionary];NSDictionary *gifProperties = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:0] forKey:(NSString *)kCGImagePropertyGIFLoopCount] forKey:(NSString *)kCGImagePropertyGIFDictionary];CGImageSourceRef imageSourceRef1 = CGImageSourceCreateWithData((CFDataRef)img1Data, (CFDictionaryRef)frameProperties);CGImageSourceRef imageSourceRef2 = CGImageSourceCreateWithData((CFDataRef)img2Data, (CFDictionaryRef)frameProperties);CGImageRef imgRef1 = CGImageSourceCreateImageAtIndex(imageSourceRef1, 0, NULL);CGImageRef imgRef2 = CGImageSourceCreateImageAtIndex(imageSourceRef2, 0, NULL);imageDest = CGImageDestinationCreateWithURL((CFURLRef)destUrl, (CFStringRef)uti, 2, NULL);CGImageDestinationAddImage(imageDest, imgRef1, (CFDictionaryRef)frameProperties);CGImageDestinationAddImage(imageDest, imgRef2, (CFDictionaryRef)frameProperties);CGImageDestinationFinalize(imageDest);上面实现了控制播放的速度,使用CoreAnimation来添加水印等功能可以查看API,还是比较简单的。
0 0
- 图片合成GIF
- gif图片的合成
- 图片合成gif图 iOS
- Python2.7 图片合成gif
- Android合成GIF图片JNI版
- Android合成GIF图片JNI版
- photoshop将多个图片合成制作gif
- JAVA 由图片合成gif文件
- Android gif图片的解码与合成
- Android实现多张图片合成GIF
- ImageMagicK编译--合成图片为gif
- iOS学习笔记--gif图片合成
- gif图片合成与拆分-jpg图片生成
- gif图片合成与拆分-jpg图片生成
- gif图片拆帧及合成[python]实现
- IOS:如何使用多张图片合成GIF
- iOS中GIF图片的解析+合成
- Linux 下将多个 *.png 图片合成一个 *.gif 文件
- QT中QToolBox的使用,实现抽屉效果
- C++派生类与基类的转换
- eclipse项目目录配置
- 对Intent与Bundle的学习
- Linux字符设备驱动总结
- 图片合成GIF
- 带格式的输出语句及输入语句
- Android 删除所有短信、联系人和通话记录
- self-righteous:Agile Development
- PCI设备内存操作函数总结
- Android NDK开发指南---Android.mk文件
- SELECT INTO 和 INSERT INTO SELECT 两种表复制语句
- MySQL复制--最快的从库搭建方法(tar包)
- 心情