Fix broken commit and adjust for different ImageMagick library versions