seanooi / iOS-WebP

Google's WebP image format decoder and encoder for iOS
http://seanooi.github.io/iOS-WebP/
MIT License
856 stars 138 forks source link

UIImageWriteToSavedPhotosAlbum() failed #29

Open lvyile opened 8 years ago

lvyile commented 8 years ago
    UIImageView *currentImageView  = xxx // this is a iOS webp image
// then:
    UIImageWriteToSavedPhotosAlbum(currentImageView.image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo;
{
// error is:
//There was a problem writing this asset because the write failed.
}
lvyile commented 8 years ago

temp solution is :+1:

    UIGraphicsBeginImageContextWithOptions(currentImageView.bounds.size, NO, 1.f);
    [currentImageView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *uiImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();