Image::WebP - binding to Google's libwebp.
use Image::WebP; my $foo = Image::WebP->new(); # get info about image my $img_info = $foo->WebPGetInfo($webp_image_data); # uncompress Webp-encoded data: my $raw_data = $foo->WebPDecodeSimple($webp_image_data, "RGB");
Constructor. No params needed.
Return hashref with information about passed <img_data> - the raw data of webp image file. Check field 'status', if it 0, then the webp data was invalid and image decoding failed. The other fileds is 'width' and 'height', and 'has_alpha'.
Decode Webp image <data> into specified rgb <format>. Format can be: "RGBA", "ARGB", "BGRA", "RGB", "BGR". Returns raw string. If you pass wrong webp data, you can catch segfault!
Returns hash like:
{ 'data' => ..., 'width' => ..., 'height' => ... }
Encode raw RGB <data> with specified <width> and <height> into webp image and return it as string. Parameter <format> stands for raw data format, you pass to function, it can be one of "RGBA", "BGRA", "RGB", "BGR". The <format> must be exactly same as your data, or you will encounter segfault!
The <opts> parameter stands for encoding options. For understanding them see https://developers.google.com/speed/webp/docs/api. Supported options are:
{ stride => integer, # not specify it unless you really know what you want quality => float, # 0.0 - 100.0, needed if you compress to lossy format loseless=> 0 || 1, # 0 for lossy encoding and 1 for loseless }
Zargener, <zargener at gmail.com>
<zargener at gmail.com>
Copyright 2013 Zargener.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
To install Image::WebP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::WebP
CPAN shell
perl -MCPAN -e shell install Image::WebP
For more information on module installation, please visit the detailed CPAN module installation guide.