Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on image encoding (WebPPictureImportRGBA) #148

Open
DomenicoGonnelli opened this issue Jun 8, 2020 · 1 comment
Open

Crash on image encoding (WebPPictureImportRGBA) #148

DomenicoGonnelli opened this issue Jun 8, 2020 · 1 comment

Comments

@DomenicoGonnelli
Copy link

Hi,
I'm using this lib and I have a problem to convert png image on webp. In particular when I try to encode png Data, App crashes on line 1284
if(!WebPPictureImportRGBA(&picture, buffer.data, (int)buffer.rowBytes)) goto fail;

I find a possible solution of problem: analyzing the code I see that variable "lossless" is used to set
picture.use_argb, so if you pass NO app crash on png image, if you force YES on
YYImageCoder.m - line 2683

CFDataRef frameData = YYCGImageCreateEncodedWebPData(image, YES, _quality, 4, YYImagePresetDefault);

it works.

I suggest to modify the switcher on YYImageCoder (line 2357) in
..
case YYImageTypeWebP: {
_quality = 0.8;
_lossless = YES;
} ...

@rebeloper
Copy link

Yes, adding _lossless = YES; solved the issue for me 👏 Thanks for the solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants