OPENFL haxe extensions for decoding and encoding webp 0.4.1 images (lossy, lossless, alpha, color profile, metadata (XMP/EXIF) and animation).
C Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
example
ndll
project
src/webp
tests/emscripten
tools
.gitignore
README.md
build_android.bat
build_android.sh
build_blackberry.bat
build_ios.sh
build_linux.sh
build_mac.sh
build_tizen.bat
build_webos.bat
build_windows.bat
deploy.bat
haxelib.json
include.xml
set_dev_directory.bat

README.md

WEBP:

Information about 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);