GD
view release on metacpan or search on metacpan
lib/GD/Image.pm view on Meta::CPAN
Supported Image formats, also returned by C<supported()>,
as lowercase strings.
=over 4
=item Png
=item Gif
=item Jpeg
=item Tiff
=item Xbm
=item WBMP
=item BMP
=item GifAnim
=item Webp
=item Heif
=item Avif
=back
Unsupported Image formats:
=over 4
=item Gd
=item Gd2
=item Xpm
=back
See L<GD>
=head1 AUTHOR
The GD.pm interface is copyright 1995-2005, Lincoln D. Stein. It is
distributed under the same terms as Perl itself. See the "Artistic
License" in the Perl source code distribution for licensing terms.
The latest versions of GD.pm are available on CPAN:
http://www.cpan.org
=head1 SEE ALSO
L<GD>
L<GD::Polyline>,
L<GD::SVG>,
L<GD::Simple>,
L<Image::Magick>
=cut
# Copyright 1995 Lincoln D. Stein. See accompanying README file for
# usage information
*stringTTF = \&GD::Image::stringFT;
sub _make_filehandle {
shift; # get rid of class
no strict 'refs';
my $thing = shift;
return $thing if defined(fileno $thing);
# otherwise try qualifying it into caller's package
my $fh;
{
local $^W = 0; # to avoid uninitialized variable warning from Symbol.pm
my $pkg = caller(2);
$pkg = "main" unless defined $pkg;;
$fh = qualify_to_ref($thing,$pkg);
}
return $fh if defined(fileno $fh);
# otherwise treat it as a file to open
$fh = gensym;
if (!open($fh,$thing)) {
die "$thing not found: $!";
return undef;
}
return $fh;
}
sub new {
my $pack = shift;
if (@_ == 1) {
if (my $type = _image_type($_[0])) {
my $method = "newFrom${type}Data";
return unless $pack->can($method);
return $pack->$method($_[0]);
} elsif (-f $_[0] and $_[0] =~ /\.gd$/) {
my $type = 'Gd';
return unless my $fh = $pack->_make_filehandle($_[0]);
my $method = "newFrom${type}";
return unless $pack->can($method);
return $pack->$method($fh);
} elsif (-f $_[0] and $_[0] =~ /\.gd2$/) {
my $type = 'Gd2';
return unless my $fh = $pack->_make_filehandle($_[0]);
my $method = "newFrom${type}";
return unless $pack->can($method);
return $pack->$method($fh);
} elsif (-f $_[0] and $_[0] =~ /\.wbmp$/) {
my $type = 'WBMP';
return unless my $fh = $pack->_make_filehandle($_[0]);
my $method = "newFrom${type}";
return unless $pack->can($method);
return $pack->$method($fh);
} elsif (-f $_[0] and $_[0] =~ /\.xpm$/) {
my $type = 'Xpm';
( run in 1.687 second using v1.01-cache-2.11-cpan-39bf76dae61 )