Chart-PNGgraph

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

			'SUFFIX'   		=> 'gz', 
		},
 
        'clean'   	=> { 'FILES' => q(*% *.b[ac]k *.old tags) },
);

# GD has already been 'required' by the WriteMakeFile call, but it
# doesn't hurt to do it again.
require GD;

# REMOVE THE FOLLOWING CHECKS IF YOU DON'T USE Image::Magick AND YOU
# HAVE EDITED GIFgraph::Convert.
if (GD::Image->can('gif'))
{
	print "Checking for conversion of GIF to PNG\n";
	require GIFgraph::Convert;
	GIFgraph::Convert::checkImageMagick();
}

print <<END;

README  view on Meta::CPAN

that the two code bases for GIFgraph and Chart::PNGgraph have been
merged back together, and will be maintained in a single spot again.
Blame Unisys and their childishness over the LZW patent for all this.

GD VERSIONS

If you want to use a GD version 1.20 or up, you will need to have
something installed that can do an on-the-fly conversion of PNG to GIF.
I can't recommend that you do this way, but there may be some obscure
and odd reason that you want to produce PNG images, but have to use an
old GD. If you have to: I recommend that you use Image::Magick, since
that is what the Chart::PNGgraph module has been setup to use. If you
don't want to, or can't install Image::Magick, you will have to edit the
file Chart/PNGgraph/Convert.pm to provide a different sub gif2png.

TESTED PLATFORMS

None.  In fact the tests have been removed as a reminder that this package
now exists solely for backward compatibility.  If your existing scripts work
with this module, then that is all that's important at this stage.

AUTHOR

lib/Chart/PNGgraph.pm  view on Meta::CPAN

B<Chart::PNGgraph> is a I<perl5> module to create PNG output
for a graph.

Chart::PNGgraph is nothing more than a wrapper around GD::Graph, and its
use is deprecated. It only exists for backward compatibility. The
documentation for all the functionality can be found in L<GD::Graph>.

This module should work with all versions of GD, but it has only been
tested with version 1.19 and above. Version 1.19 is the last version
that produces GIF output, and requires a conversion step. The default
distribution of Chart::PNGgraph uses Image::Magick for this. If you'd
like to use something else, please replace the sub png2gif in
Chart::PNGgraph::Convert with something more to your liking.

=head1 NOTES

Note that if you use Chart::PNGgraph with a GD version 1.19 or lower
that any included logos will have to be in the GIF format. The only time
that PNG comes into play is _after_ GD has done its work, and the GIF
gets converted to PNG. There are no plans to change that behaviour; it's
too much work, and you should really be upgrading to a version of GD

lib/Chart/PNGgraph/Convert.pm  view on Meta::CPAN

use Carp;

# Change this sub if you want to use something else to convert from GIF
# to PNG.
sub gif2png
{
	my $gif  = shift;

	checkImageMagick();

	my $im = Image::Magick->new(magick => 'gif') or 
		croak 'Cannot create Image::Magick object';
	my $rc = $im->BlobToImage($gif);
	carp $rc if $rc;
	$rc = $im->Set(magick => 'png');
	return $im->ImageToBlob();
}

sub checkImageMagick
{
	eval "require Image::Magick";
	croak <<EOMSG if $@;

	Image::Magick cannot be found. Your version of GD exports GIF format
	graphics, and Chart:PNGgraph needs something to convert those to
	PNG. If you want to provide an alternative method, please edit the
	sub gif2png in the file Chart/PNGgraph/Convert.pm, and if you're
	installing, Makefile.PL.

EOMSG
}

1;



( run in 0.538 second using v1.01-cache-2.11-cpan-beeb90c9504 )