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

When I set alpah parameter to 1, some colors lose

Open gonghao opened this issue 11 years ago • 4 comments

I met an strange question which is that I compressed an UIImage to WebP, but some colors lose, and I also try to use other quality and WEBP_PRESET but fianlly I find the problem is casued by ALPHA parameter. I tried use other numbers less than 1 all are correct. And I try to edit some source code:

if (alpha <= 1) {
    image = [self webPImage:image withAlpha:alpha];
}

to enforce call webPImage:withAlpha method first and will fix this problem. I don't why, so could you help to fix this issue?

THX

gonghao avatar Apr 01 '14 15:04 gonghao

I might need to run more tests to make sure it works well with most images, but can you provide a screenshot? It seems to be working fine on my end. This is the screenshot I have. http://i.imgur.com/1ItYyX3.png Alpha is 1.0 for the top image, and 0.5 for the bottom image

seanooi avatar Apr 02 '14 19:04 seanooi

@seanooi Hi, I make some tests, when I use iPhone Simulator 7.1 64-bit, it looks very nice. But when I switch to my iPhone 5s, the terrible thing comes.

https://www.dropbox.com/s/l1tmxkgensosq4f/IMG_2631.PNG Here is my screenshot, the top image use Alpha 0.99999, the bottom use 1.f

gonghao avatar Apr 12 '14 08:04 gonghao

I took a closer look at it and noticed the if (alpha <= 1) statement isn't really needed. I will run more tests but it'll most probably be taken out of future releases.

seanooi avatar May 24 '14 22:05 seanooi

Yeah, same thing is happening to me. Removing the if alpha <= 1 clause corrects the issue when the alpha is one. Otherwise, I consistently get a blue hue on all converted images.

ThePragmaticArt avatar Apr 27 '15 05:04 ThePragmaticArt