Nothing much here, but I thought I’d share a handy little library to decode WebP in Flash. Here’s two demo’s : Lena and V for Vendetta, both encoded using the webp binaries provided here.
It’s a small wrapper around the WebP library ported with Alchemy. The port is pretty easy to do using Alchemy, aside from some issues with the Alchemy toolchain pretending to be a normal gcc toolchain; it enables some x86 asm code for cpu identification in the webp code, which obviously won’t work in Flash. After those issues are resolved getting up and running is easy.
However, I’d figure I’d post this as I have seen several requests for making webp work in Flash.
Although webp decoding isn’t there natively om the FlashPlayer, this should help you a long way. Read further for an example on usage and download of the swc.
As for this blog; due to time constraints I find myself not being able to update it regularly, even though I want to. Also, as I do a lot more tech then just Flash these days, I’m looking for a way to post experiments in other technologies, without the daunting task of making a full scale blogpost about it….more on that when I figured it out.
Download webplib.swc.
public class Main extends Sprite { [Embed(source="V.webp", mimeType="application/octet-stream")] private const WebPImageClass:Class; public function Main() { stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; init(); } private function init():void { WebPLib.init();//Only needs to be called once. var bitmapData:BitmapData = WebPLib.decode(new WebPImageClass() as ByteArray); addChild(new Bitmap(bitmapData)); } }
download link is broken!!
Thanks hika, sorry about that, fixed it.
awesome! just last weekend I was thinking about trying out webp on flash!
thanx for sharing
Does this support transparency? Cos as far as I know, they just added it.
I has tried.
Dos not support transparency
Unfortunatly your work will become useless as Adobe discontinues Alchemy opcodes :
http://blogs.adobe.com/flashplayer/2011/09/updates-from-the-lab.html
Too bad news !
very good, maybe we have the same idea:)
this is my html-webp plugin researced in a few months ago:
http://www.etherdream.com/webp/
i also compiled by alchemy. and this’s a swf version:
http://www.etherdream.com/WebP/Flash/WebPDemo.swf
more exchanges:)
Could you tell me how to port a C library to Alchemy? I want to compile thelibspeex to SWC, Here is my question. Big Thanks!
Awesome stuff – any chance you can post the source code for the wrapper? Interested in how you wrote the Alchemy glue
)
It doesn’t support alpha channel.
Can somebody build it with transparency support?
Hi, I do a same work, but can support transparency image:
http://www.sineysoft.com/blog/post/124.html
Swc download here:
http://www.sineysoft.com/image/webp/webpswc.swc
Pingback: How to port WebP 0.2.0 to Flash using Flascc (Alchemy 2.0) | 7uJian's Blog