1Image::Info::SVG(3) User Contributed Perl Documentation Image::Info::SVG(3)
2
3
4
6 Image::Info::SVG - SVG support for Image::Info
7
9 use Image::Info qw(image_info dim);
10
11 my $info = image_info("image.svg");
12 if (my $error = $info->{error}) {
13 die "Can't parse image info: $error\n";
14 }
15 my $title = $info->{SVG_Title};
16
17 my($w, $h) = dim($info);
18
20 This modules supplies the standard key names except for BitsPerSample,
21 Compression, Gamma, Interlace, LastModificationTime, as well as:
22
23 ImageDescription
24 The image description, corresponds to <desc>.
25
26 SVG_Image
27 A scalar or reference to an array of scalars containing the URI's
28 of embedded images (JPG or PNG) that are embedded in the image.
29
30 SVG_StandAlone
31 Whether or not the image is standalone.
32
33 SVG_Title
34 The image title, corresponds to <title>
35
36 SVG_Version
37 The URI of the DTD the image conforms to.
38
40 process_file()
41 $info->process_file($source, $options);
42
43 Processes one file and sets the found info fields in the $info object.
44
46 This module requires either XML::LibXML::Reader or XML::Simple.
47
49 Previous versions (until Image-Info-1.28) used XML::Simple as the
50 underlying parser. Since Image-Info-1.29 the default parser is
51 XML::LibXML::Reader which is much more faster, memory-efficient, and
52 does not rely on regular expressions for some aspects of XML parsing.
53 If for some reason you need the old parser, you can force it by setting
54 the variable @Image::Info::SVG::PREFER_MODULE as early as possible:
55
56 use Image::Info;
57 @Image::Info::SVG::PREFER_MODULE = qw(Image::Info::SVG::XMLSimple Image::Info::SVG::XMLLibXMLReader);
58
59 The variable $Image::Info::SVG::USING_MODULE can be queried to see
60 which parser is in use (after Image::Info::SVG is required).
61
62 Since 1.38_50 processing of XML external entities (XXE) is not done
63 anymore for security reasons in both backends
64 (Image::Info::SVG::XMLLibXMLReader and Image::Info::SVG::XMLSimple).
65 Controlling XXE processing behavior in XML::Simple is not really
66 possible (see <https://rt.cpan.org/Ticket/Display.html?id=83794>), so
67 as a workaround the underlying SAX parser is fixed to
68 XML::SAX::PurePerl which is uncapable of processing external entities —
69 but unfortunately it is also a slow parser.
70
72 Image::Info, XML::LibXML::Reader, XML::Simple, XML::SAX::PurePerl
73
75 For more information about SVG see <http://www.w3.org/Graphics/SVG/>
76
77 Random notes:
78
79 Colors
80 # iterate over polygon,rect,circle,ellipse,line,polyline,text for style->stroke: style->fill:?
81 # and iterate over each of these within <g> too?! and recurse?!
82 # append <color>'s
83 # perhaps even deep recursion through <svg>'s?
84 ColorProfile <color-profile>
85 RenderingIntent ?
86 requiredFeatures
87 requiredExtensions
88 systemLanguage
89
91 Jerrad Pierce <belg4mit@mit.edu>/<webmaster@pthbb.org> wrote the
92 original code based on XML::Simple
93
94 Slaven Rezic <srezic@cpan.org> wrote the code using XML::LibXML::Reader
95
96 This library is free software; you can redistribute it and/or modify it
97 under the same terms as Perl itself.
98
99
100
101perl v5.38.0 2023-08-20 Image::Info::SVG(3)