iOS-WebP icon indicating copy to clipboard operation
iOS-WebP copied to clipboard

when i get UIImage from ALAssetsLibrary,then use "imageToWebP"method, the image color is change

Open lostkid opened this issue 10 years ago • 2 comments

ALAssetRepresentation *assetRep = [currentAsset defaultRepresentation]; CGImageRef imgRef = [assetRep fullResolutionImage]; UIImage *postImage = [UIImage imageWithCGImage:imgRef scale:assetRep.scale orientation:UIImageOrientationUp]; NSData *imageData = [UIImage imageToWebP:postImg quality:50.f];

then show this imageData in the app, the image Color is wrong. but if I convert native png or jpg to NSData ,it is right. I don't know why.

like this ,it is right. UIImage *image = [UIImage imageNamed:@"xxx.png"]; NSData *imageData = [UIImage imageToWebP:image quality:50.f];

lostkid avatar Dec 04 '15 08:12 lostkid

just now change this method "if (alpha < 1) { }" to "if (alpha <= 1) { }", the image color is right.

  • (NSData )convertToWebP:(UIImage *)image quality:(CGFloat)quality alpha:(CGFloat)alpha preset:(WebPPreset)preset configBlock:(void (^)(WebPConfig *))configBlock error:(NSError *)error

lostkid avatar Dec 04 '15 08:12 lostkid

i have this problem too. But when i change "if (alpha < 1) { }" to "if (alpha <= 1) { }" it also have some problem the webPimage has some white cover on it.

nerohem avatar Apr 05 '16 07:04 nerohem