summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/img.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index b92e24c..d31febf 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -65,10 +65,17 @@ sub preprocess (@) {
my $dir = $params{page};
my $base = IkiWiki::basename($file);
my $issvg = $base=~s/\.svg$/.png/i;
+ my $usegm = 1;
- eval q{use Image::Magick};
- error gettext("Image::Magick is not installed") if $@;
- my $im = Image::Magick->new($issvg ? (magick => "png") : ());
+ eval q{use Graphics::Magick};
+ if ($@) {
+ $usegm = 0;
+ eval q{use Image::Magick};
+ error gettext("Image::Magick is not installed") if $@;
+ }
+ my $im = $usegm
+ ? Graphics::Magick->new($issvg ? (magick => "png") : ())
+ : Image::Magick->new($issvg ? (magick => "png") : ());
my $imglink;
my $r = $im->Read($srcfile);
error sprintf(gettext("failed to read %s: %s"), $file, $r) if $r;
@@ -113,7 +120,7 @@ sub preprocess (@) {
will_render($params{page}, $imglink);
if (-e $outfile && (-M $srcfile >= -M $outfile)) {
- $im = Image::Magick->new;
+ $im = $usegm ? Graphics::Magick->new : Image::Magick->new;
$r = $im->Read($outfile);
error sprintf(gettext("failed to read %s: %s"), $outfile, $r) if $r;
}