openfl-webp

OPENFL haxe extensions for decoding and encoding webp 0.4.1 images (lossy, lossless and alpha support).
https://github.com/soywiz/haxe-openfl-webp

To install, run:

haxelib install openfl-webp 0.0.7 

See using Haxelib in Haxelib documentation for more information.

README.md

WEBP:

Information about webp: https://developers.google.com/speed/webp/ http://code.google.com/p/webp/

Setup/Installing:

You need HAXE and OPENFL. http://www.openfl.org/

haxelib install openfl-webp

Usage/API:

The Webp API is pretty simple. It uses ByteArray and BitmapData objects for encoding/decoding.

webp.Webp.getDecoderVersion():String
webp.Webp.getEncoderVersion():String
webp.Webp.getImageInfo(bytes:ByteArray):WebpInfo;
webp.Webp.decodeAsBitmapData(bytes:ByteArray):BitmapData;
webp.Webp.encodeBitmapData(bitmapData:BitmapData, lossless:Bool = false, quality_factor:Float = 86):ByteArray

Simple Example:

You can obtain webp data using Assets.getBytes or sys.io.File functions (available on cpp and neko targets).

var bytes:ByteArray = openfl.Assets.getBytes("image.webp");
var bitmapData:BitmapData = webp.Webp.decodeAsBitmapData(bytes);
var bitmap:Bitmap = new Bitmap(bitmapData);
addChild(bitmap);
Contributors
soywiz
Version
0.0.7
Published
3 years ago
License
MIT

All libraries are free

Every month, more than thousand developers use haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on Github!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on Github