IOS HEIC HEIF 转 JPEG

核心代码:UIImageJPEGRepresentation(resultImage, 0.7)

在PHImageManager中 resultHandler中处理即可

 [[PHImageManager defaultManager] requestImageForAsset:asset targetSize:PHImageManagerMaximumSize contentMode:PHImageContentModeDefault options:option resultHandler:^(UIImage *resultImage, NSDictionary *info){

   NSData *data = UIImageJPEGRepresentation(resultImage, 0.7);

}];

格式判断:HEIC

             if([[fullPath pathExtension].lowercaseString isEqualToString:@"heic"]){

                 file.fileData = UIImageJPEGRepresentation(resultImage, 0.7);

                 file.fileName = [file.fileName stringByReplacingOccurrencesOfString:@".HEIC" withString:@".JPEG"];

             }

你可能感兴趣的:(IOS,IOS)