WebP decoder for Flash.

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;

	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));
This entry was posted in Uncategorized. Bookmark the permalink.

12 Responses to WebP decoder for Flash.

  1. hika says:

    download link is broken!!

  2. UnitZeroOne says:

    Thanks hika, sorry about that, fixed it.

  3. awesome! just last weekend I was thinking about trying out webp on flash!
    thanx for sharing :)

  4. Ryan Speets says:

    Does this support transparency? Cos as far as I know, they just added it.

  5. jim says:

    I has tried.
    Dos not support transparency

  6. Eric Priou says:

    Unfortunatly your work will become useless as Adobe discontinues Alchemy opcodes :
    Too bad news !

  7. zjcqoo says:

    very good, maybe we have the same idea:)

    this is my html-webp plugin researced in a few months ago:

    i also compiled by alchemy. and this’s a swf version:

    more exchanges:)

  8. Elf Sundae says:

    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!

  9. Jason McGuirk says:

    Awesome stuff – any chance you can post the source code for the wrapper? Interested in how you wrote the Alchemy glue :o )

  10. norn says:

    It doesn’t support alpha channel.
    Can somebody build it with transparency support?

  11. Siney says:

    Hi, I do a same work, but can support transparency image:

    Swc download here:

  12. Pingback: How to port WebP 0.2.0 to Flash using Flascc (Alchemy 2.0) | 7uJian's Blog

Leave a Reply to hika Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.