博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何gif图片转data?完整解决
阅读量:4621 次
发布时间:2019-06-09

本文共 898 字,大约阅读时间需要 2 分钟。

 

 

 

处理方法:

NSURL *imageRefURL = [info valueForKey:UIImagePickerControllerReferenceURL];ALAssetsLibrary* assetLibrary = [[ALAssetsLibrary alloc] init];void (^ALAssetsLibraryAssetForURLResultBlock)(ALAsset *) = ^(ALAsset *asset) {if (asset != nil) {ALAssetRepresentation *rep = [asset defaultRepresentation];Byte imageBuffer = (Byte)malloc(rep.size);NSUInteger bufferSize = [rep getBytes:imageBuffer fromOffset:0.0 length:rep.size error:nil];NSData *imageData = [NSData dataWithBytesNoCopy:imageBuffer length:bufferSize freeWhenDone:YES];// 这个imageData就是gif的了} else {}};[assetLibrary assetForURL:imageRefURLresultBlock:ALAssetsLibraryAssetForURLResultBlockfailureBlock:^(NSError *error){}]; info来源如下:

 

 

 

 

info数据来源:打开相册选择完成的代理方法 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary
*)info;

 

转载于:https://www.cnblogs.com/OIMM/p/11430438.html

你可能感兴趣的文章
linux使用rz、sz快速上传、下载文件
查看>>
判断数字的正则表达式
查看>>
DOC常用命令(转)
查看>>
php写一个判断是否有cookie的脚本
查看>>
Mac配置Fiddler抓包工具
查看>>
转:Java并发集合
查看>>
Word截图PNG,并压缩图片大小
查看>>
Python项目对接CAS方案
查看>>
mysql产生随机数
查看>>
编程风格
查看>>
熟悉常用的Linux命令
查看>>
易之 - 我是个大师(2014年3月6日)
查看>>
Delphi中窗体的事件
查看>>
file_get_contents()获取https出现这个错误Unable to find the wrapper “https” – did
查看>>
linux vi编辑器
查看>>
js树形结构-----(BST)二叉树增删查
查看>>
contract
查看>>
Python语言编程
查看>>
[poj 1469]Courses
查看>>
vue+element-ui实现表格checkbox单选
查看>>