My starting point would always be to (try to) get a stack trace, by inserting something like the following before the call that dies:
use Carp;
local $SIG{__DIE__} = sub { Carp::confess(@_) };
That would give additional diagnostic information to help you or others figure out what's going on.
It isn't clear exactly what is happening when you run the script though - does it die with the error message in the title, or does it reach your print "Error b: $err\n"; line? It would also be useful to know the version numbers for perl and for Image::Magick - I assume something getting upgraded is what introduced the problem.
Searching around a bit, there appear to be two distinct versions of the Image::Magick module: one provided on CPAN (currently at version 7.1.0-0), another provided as a stub as part of the ImageMagick library distribution (on github here). The filename in your error message suggests you are using the library distribution, which may make it a bit harder to diagnose.