NAME
Imager::File::WEBP - read and write WEBP files
SYNOPSIS
use Imager;
my $img = Imager->new;
$img->read(file=>"foo.webp")
or die $img->errstr;
# type won't be necessary if the extension is webp from Imager 1.008
$img->write(file => "foo.webp", type => "webp")
or die $img->errstr;
DESCRIPTION
Implements .webp file support for Imager.
So far this is very, very basic. No tags are set when reading images and tags are ignored when writing.
Due to the limitations of webp
grayscale images are written as RGB images.
TAGS
webp_mode
- set when reading an image and used when writing. Possible values:lossy
- write in lossy mode. This is the default.lossless
- write in lossless mode.
webp_quality
- the lossy compression quality, a floating point number from 0 (bad) to 100 (better). Default: 80.
Animation tags
These only have meaning for files with more than one image.
webp_left
,webp_top
- position of the frame within the animation frame. Only has meaning for multiple image files. Odd numbers are stored as the even number just below. Default: 0.webp_duraton
- duration of the frame in milliseconds. Default: 100.webp_loop_count
- the number of times to loop the animation. When writing an animation this is fetched only from the first image. When reading, the same file global value is set for every image read. Default: 0.webp_background
- the background color for the animation. When writing an animation this is fetched only from the first image. When reading, the same file global value is set for every image read. Default: white.webp_dispose
- the disposal method for the frame:background
- restore to the background before displaying the next frame.none
- leave the canvas as is when drawing the next frame.
Default:
background
.webp_blend
- the blend method for the frame:alpha
- alpha combine the frame with canvas.none
- replace the area under the image with the frame.
If the frame has no alpha channel this option makes no difference.
Default:
alpha
.
TODO
These aren't intended immediately, but are possible future enhancements.
Compression level support for lossless
This is complicated by the simple lossless API doesn't support it (while lossy does.)
Parse EXIF metadata
To fix this I'd probably pull imexif.* out of Imager::File::JPEG and make it part of the Imager API.
Maybe also add extended EXIF/Geotagging via libexif or Exiftool.
Error handling tests (and probably implementation)
I think this is largely done.
AUTHOR
Tony Cook <tonyc@cpan.org>
SEE ALSO
Imager, Imager::Files.