Image::GIF::Encoder::PP - Pure perl GIF encoding
use Image::GIF::Encoder::PP; my $palette = pack('CCCCCC', 0xFF, 0xFF, 0xFF, 0xDA, 0x09, 0xFF); # Pack the RGB color pallete my $gif = Image::GIF::Encoder::PP->new('out.gif', 200, 200, $palette, 1, 0, 0); # create a 200x200 infinitely looping 1 bit color palette transparent gif $gif->{'frame'} = pack('x10000'); # set the pixels of the frame to palette index 0 (transparent in this case) Image::GIF::Encoder::PP::scale($frame, 100, 100, 2, \$destframe); # scale a 100x100 frame by 2 and store in $destframe $gif->add_frame(5); # add a frame with a 5 ms delay undef $gif; # finish writing to gif
Constructs a new GIF object.
If $filename is defined, a file will be created, otherwise it will write the image to STDOUT.
$filename
$palette is a binary array of RGB24 its length should correspond to bitdepth $depth. 2 colors (6 bytes) for a bitdepth of 1, 4 colors, (12 bytes) for a bitdepth of 2, etc.
$palette
$depth
$loop controls how many times to loop, 0 loops infinitely, 1 or a negative value should play once with most players.
$loop
$transparent_index marks a color index to show as transparent instead of that color. Use -1 if there is not transparent index.
$transparent_index
Set $gif->{'frame'} to your binary array of pixels, one byte per pixel corresponding to a palette index.
$gif->{'frame'}
For example to set a 100x100 frame to the first color index $gif->{'frame'} = pack('x10000')
$gif->{'frame'} = pack('x10000')
Adds the image data from $gif->{'frame'} to the GIF where $delay is the number of milliseconds between each frame.
$delay
The final image data is flushed when the $gif object is DESTROYed.
$gif
Scales a $wx$h frame by $times and stores it in the $destframe buffer. If you wish to make a scaled gif, be sure to adjust the $width and $height appropriately. For example 100x100 frames scaled by 2 needs a 200x200 $gif.
$w
$h
$times
$destframe
$width
$height
Converts a frame from $srcbitsperpixel to $desiredbitsperpixel and returns the resulting frame. For creating a gif with Image::GIF::Encoder::PP $desiredbitsperpixel should be 8.
$srcbitsperpixel
$desiredbitsperpixel
Gavin Hayes, <gahayes at cpan.org>
<gahayes at cpan.org>
You can find documentation for this module with the perldoc command.
perldoc Image::GIF::Encoder::PP
Support and bug reports can be found at the repository https://github.com/G4Vi/gifenc-pl
This software is copyright (c) 2021-2022 by Gavin Hayes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Image::GIF::Encoder::PP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::GIF::Encoder::PP
CPAN shell
perl -MCPAN -e shell install Image::GIF::Encoder::PP
For more information on module installation, please visit the detailed CPAN module installation guide.