Apache-AxKit-Language-Svg2AnyFormat
view release on metacpan or search on metacpan
Revision history for Perl extension Apache-AxKit-Language-Svg2AnyFormat.
0.06 - fixed bug when running in pipeline open of tempfile failed (Mark Charter)
- fixed bug with character encoding and toString by using toFile() now => preformance improvement (Mark Charter)
0.05
- fixed bug when trying to use Image::LibRSVG, always Image::Magick
has been used
0.04 - fixed documentation issues
- fixed versioning issues (not upgrading version to 0.03)
0.03 - fixed bug of creating of not cleaning up temp-files
- completly refactored Svg2AnyFormat.pm
- switched from rsvg commandline support to Image::LibRSVG
- added tiff format
Makefile.PL view on Meta::CPAN
# use 5.008;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
'AUTHOR' => 'Tom Schindl <tom.schindl@bestsolution.at>',
'NAME' => 'Apache::AxKit::Language::Svg2AnyFormat',
'VERSION_FROM' => 'lib/Apache/AxKit/Language/Svg2AnyFormat.pm', # finds $VERSION
'PREREQ_PM' => {
AxKit => "1.6.1",
Image::Magick => "5.55",
Image::LibRSVG => "0.01",
},
'dist' => {
COMPRESS => "gzip -9",
SUFFIX => "gz",
},
);
perl Makefile.PL
make
make install
DEPENDENCIES
This module requires these other modules and libraries:
Axkit - Version 1.6.1 or higher ( http://www.axkit.org )
Image::Magick - Version 5.55 or higher ( http://www.imagemagick.org )
Image::LibRSVG - Version 0.01 or higher ( http://search.cpan.org/~tomson/?D=D )
Please note that everything may also work by using libaries with a lower
than the one mentionned above.
COPYRIGHT AND LICENCE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
lib/Apache/AxKit/Language/Svg2AnyFormat.pm view on Meta::CPAN
}
return $converted_file;
}
sub serializeWithImageMagick {
my $infile = shift;
my $converted_file = "$TEMPDIR_/temp." . shift;
my $local_dir;
require Image::Magick;
AxKit::Debug(8, "Serializer is ImageMagick");
$infile =~ s%$TEMPDIR_/%%;
$local_dir = cwd;
chdir( $TEMPDIR_ );
my $image = new Image::Magick();
my $retval = $image->Read( $infile );
if( "$retval" ) {
chdir( $local_dir );
fail( "ImageMagick Read of file '$infile' failed. Reason: $retval" );
}
$retval = $image->Write( $converted_file );
if( "$retval" ) {
lib/Apache/AxKit/Language/Svg2AnyFormat.pm view on Meta::CPAN
AxAddStyleMap application/svg2anyformat Apache::AxKit::Language::Svg2AnyFormat
AxAddProcessor application/svg2anyformat NULL
## optional with this variable you can
## overwrite the default output format
## PNG
## Supported Values(Native Formats):
## image/png
## If you specify any other format:
## svg->png is done by Image::LibRSVG
## png->chosen format Image::Magick
PerlSetVar SVGOutputMimeType image/jpeg
PerlSetVar SVGOutputSerializer LibRSVG
## optional module to pass the format using cgi-parameters
## to the module. For supported values see above
## and the man-page of the plugin
AxAddPlugin Apache::AxKit::Plugin::SvgCgiSerialize
</Files>
=head1 DESCRIPTION
Svg2AnyFormat is a serializer which can transform SVG to many different
output formats(e.g. png, jpg, ... ). At the moment it uses Image::Magick or LibRSVG as conversion libraries
which do not support the whole set of svg features. In one case the conversion
could work in another not. You have to give it a try. Please note because
Svg2AnyFormat to any format is a searializer it HAS TO BE LAST in the transformer
chain!!!!
Please note when referencing external material (e.g. Images) you'll have to use an absolute path
=head2 Image::Magick
If no SVGOutputSerializer is set Image::Magick is used as default. The reason is simply
because of backward compatility. You could also set Image::Magick explicitly with
=head3 Example:
PerlSetVar SVGOutputSerializer ImageMagick
=head3 Advantges:
=over
=item
lib/Apache/AxKit/Language/Svg2AnyFormat.pm view on Meta::CPAN
=head3 Example:
PerlSetVar SVGOutputSerializer LibRSVG
=head3 Advantages
=over
=item
supports more of SVG-spec than Image::Magick
=item
not that big
=back
=head3 Disadvantages:
=over
=item
* Perl-Module highly experimental
=item
only PNG supported as output format. This is solved by using
Image::Magick in a second transformation step (LOW Performance!!!).
=back
=head1 VERSION
0.03
=head1 SEE ALSO
L<Apache::AxKit::Plugin::SvgCgiSerialize>
( run in 0.399 second using v1.01-cache-2.11-cpan-beeb90c9504 )