1 package Imager::File::GIF;
4 use vars qw($VERSION @ISA);
10 XSLoader::load('Imager::File::GIF', $VERSION);
13 Imager->register_reader
18 my ($im, $io, %hsh) = @_;
20 if ($hsh{gif_consolidate}) {
23 ($im->{IMG}, $colors) =i_readgif_wiol( $io );
25 ${ $hsh{colors} } = [ map { NC(@$_) } @$colors ];
29 $im->{IMG} =i_readgif_wiol( $io );
33 my $page = $hsh{page};
34 defined $page or $page = 0;
35 $im->{IMG} = i_readgif_single_wiol($io, $page);
38 $im->_set_error(Imager->_error_as_msg);
42 ${ $hsh{colors} } = [ $im->getcolors ];
51 my @imgs = i_readgif_multi_wiol($io);
53 Imager->_set_error(Imager->_error_as_msg);
57 return map bless({ IMG => $_, ERRSTR => undef }, "Imager"), @imgs;
61 Imager->register_writer
66 my ($im, $io, %hsh) = @_;
68 $im->_set_opts(\%hsh, "i_", $im);
69 $im->_set_opts(\%hsh, "gif_", $im);
71 unless (i_writegif_wiol($io, \%hsh, $im->{IMG})) {
72 $im->_set_error(Imager->_error_as_msg);
79 my ($class, $io, $opts, @ims) = @_;
81 Imager->_set_opts($opts, "gif_", @ims);
83 my @work = map $_->{IMG}, @ims;
84 unless (i_writegif_wiol($io, $opts, @work)) {
85 Imager->_set_error(Imager->_error_as_msg);
97 Imager::File::GIF - read and write GIF files
103 my $img = Imager->new;
104 $img->read(file=>"foo.gif")
107 $img->write(file => "foo.gif")
112 Imager's GIF support is documented in L<Imager::Files>.
116 Tony Cook <tonyc@cpan.org>
120 Imager, Imager::Files.