wangjunbao / webp

Automatically exported from code.google.com/p/webp
0 stars 0 forks source link

Webp generated with the lib does not load on android 4.1.2 #170

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a webp from png (lossy, no alpha)
2. Take to an android project (R.drawable.pic)
3. Try to load with BitmapFactory (on android emulator 4.1.2)

What is the expected output? What do you see instead?
Expected: a bmp file
Instead: null, in the log: 
D/skia(761): --- SkImageDecoder::Factory returned null

What version of the product are you using? On what operating system?
Android emulator 4.1.2

Please provide any additional information below.
Not all the images it generates is wrong and my win64 able to load it.
The OS unable to load about 70% of my generated images.
The attached image does not load on android 4.1.2 (emulator) and was generated 
with the windows library (0.3.1)

Original issue reported on code.google.com by game.bli...@gmail.com on 4 Sep 2013 at 5:02

Attachments:

GoogleCodeExporter commented 9 years ago
The file b000.webp have Alpha and it will fail to decode natively in Android 
version prior to JB-MR2.

Attaching the same file with alpha stripped.

One can generate lossy files (without Alpha) from PNG via following command:
cwebp abc.png -noalpha -o abc.webp

Original comment by vik...@google.com on 4 Sep 2013 at 5:22

Attachments:

GoogleCodeExporter commented 9 years ago
I will check it.
Btw, quite misleading to write that webp is supported from Android 4.0+.
This table http://developer.android.com/guide/appendix/media-formats.html
is clearly not true and there is no clear description about it (or I was not 
able to find one).
Even android 4.1 could have webp 0.2 max (nearly release time), what is in 
android 4.0?

Original comment by game.bli...@gmail.com on 4 Sep 2013 at 10:25

GoogleCodeExporter commented 9 years ago
Just checked.
Even if in the RGBA the A is 255, need to set config.alpha_compression = 0 to 
ensure there will be no alpha (my mistake)
However if you set config.alpha_compression = 0 and use 
WebPPictureImportRGBA(&pic, mData, 4*mWidth) (instead of WebPPictureImportRGBX) 
it will save lossless image (config.lossless = 0 !!!), I don't know why.
According to documentation using WebPPictureImportRGBX is opcional (instead of 
WebPPictureImportRGBA).

Original comment by game.bli...@gmail.com on 4 Sep 2013 at 10:48

GoogleCodeExporter commented 9 years ago
Thanks anyway.

Original comment by game.bli...@gmail.com on 4 Sep 2013 at 10:49

GoogleCodeExporter commented 9 years ago
http://developer.android.com/guide/appendix/media-formats.html
has been updated to mention specific features:
(Android 4.0+)
(Lossless, Transparency, Android 4.2.1+)

Original comment by jz...@google.com on 28 Oct 2013 at 2:01