This used to work, but has been interpreted as a literal part of
the filename since ImageMagick 6.9.8-3. In newer versions, there does
not seem to be any way to indicate that a filename containing ':' is
to be taken literally without first knowing the decoder to use.
Signed-off-by: Simon McVittie <smcv@debian.org>
sub size($) {
my $filename = shift;
+ my $decoder;
+ if ($filename =~ m/\.png$/i) {
+ $decoder = 'png';
+ }
+ elsif ($filename =~ m/\.jpe?g$/i) {
+ $decoder = 'jpeg';
+ }
+ elsif ($filename =~ m/\.bmp$/i) {
+ $decoder = 'bmp';
+ }
+ else {
+ die "Unexpected extension in '$filename'";
+ }
my $im = Image::Magick->new();
- my $r = $im->Read(":$filename");
+ my $r = $im->Read("$decoder:$filename");
return "no image: $r" if $r;
my $w = $im->Get("width");
my $h = $im->Get("height");