UIImage

作者: 不愿将就_Once | 来源:发表于2016-11-07 09:37 被阅读17次

    将 UIImage 转换为 CIImage

    CIImage  *ciImage = [UIImage imageNamed:@"test.png"].CIImage;
    

    将 CIImage 转换为 UIImage

    UIImage * image = [UIImage imageWithCIImage:ciimage];
    

    图片转成 Base 64 编码

    //UIImage图片转成Base64字符串:
    UIImage *originImage = [UIImage imageNamed:@"originImage.png"];
    NSData *data = UIImageJPEGRepresentation(originImage, 1.0f);
    NSString *encodedImageStr = [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
    
    //Base64字符串转UIImage图片:
    NSData *decodedImageData = [[NSData alloc] 
    initWithBase64EncodedString:encodedImageStr options:NSDataBase64DecodingIgnoreUnknownCharacters];
    UIImage *decodedImage = [UIImage imageWithData:decodedImageData];
    

    相关文章

      网友评论

          本文标题:UIImage

          本文链接:https://www.haomeiwen.com/subject/gtznuttx.html