iOS GIF合成有透明通道图片重叠问题
2017-11-14 00:18
861 查看
iOS GIF合成有透明通道图片重叠问题
项目中需要用到合成gif, 如果图片含有透明通道, 则会出现重叠现象, 设置
kCGImagePropertyGIFHasGlobalColorMap
为true即可解决
下面是设置的代码,
NSMutableDictionary *gifProperty = [NSMutableDictionary
dictionary];
[gifProperty setObject:[NSNumber
numberWithFloat:frame.frame_delay]
forKey:(__bridge
id)kCGImagePropertyGIFDelayTime];
float sysVersion = [[[UIDevice
currentDevice] systemVersion]
floatValue];
if (sysVersion >=
10.0) {
// ios 10以下支持有问题 kCGImagePropertyGIFHasGlobalColorMap
[gifProperty setObject:@(true)
forKey:(__bridge
id)kCGImagePropertyGIFHasGlobalColorMap];
}
NSDictionary *frameProperties =
@{ (__bridge id)kCGImagePropertyGIFDictionary: gifProperty
};
CGImageRef ref = [frame
getImageRef];
CGImageDestinationAddImage(destination, ref, (CFDictionaryRef)frameProperties);
项目中需要用到合成gif, 如果图片含有透明通道, 则会出现重叠现象, 设置
kCGImagePropertyGIFHasGlobalColorMap
为true即可解决
下面是设置的代码,
NSMutableDictionary *gifProperty = [NSMutableDictionary
dictionary];
[gifProperty setObject:[NSNumber
numberWithFloat:frame.frame_delay]
forKey:(__bridge
id)kCGImagePropertyGIFDelayTime];
float sysVersion = [[[UIDevice
currentDevice] systemVersion]
floatValue];
if (sysVersion >=
10.0) {
// ios 10以下支持有问题 kCGImagePropertyGIFHasGlobalColorMap
[gifProperty setObject:@(true)
forKey:(__bridge
id)kCGImagePropertyGIFHasGlobalColorMap];
}
NSDictionary *frameProperties =
@{ (__bridge id)kCGImagePropertyGIFDictionary: gifProperty
};
CGImageRef ref = [frame
getImageRef];
CGImageDestinationAddImage(destination, ref, (CFDictionaryRef)frameProperties);
相关文章推荐
- IOS UITableView 图片文字重叠问题
- iOS中GIF图片的解析+合成
- iOS UITableViewCell使用gif图片的卡顿和重用问题
- 图片合成gif图 iOS
- iOS中gif图片上传的问题
- iOS 使用SDWebImage加载gif链接图片时内存过大问题
- IOS:如何使用多张图片合成GIF
- iOS学习笔记--gif图片合成
- ios-使用SDWebImage加载Gif图片的问题
- iOS 制作静态库 .a 文件 和 .framework 文件 以及解决第三方库冲突问题 最后附上图片及Xib资源打包成 bundle (转载 mark 一下)
- iOS代码实现两张图片合成一个
- iOS 图片显示中遇到的压缩与裁剪问题
- ios播放gif图片
- IOS GIF图片的解析
- PHP基于php_imagick_st-Q8.dll实现JPG合成GIF图片的方法
- iOS 选取相册图片并裁剪,解决获取图片拉伸问题
- iOS 中播放gif图片
- IOS显示gif图片,超简单方法
- PHP基于php_imagick_st-Q8.dll实现JPG合成GIF图片的方法
- iOS开发技巧之:相册中的GIF图片的读取与保存