refactoring gmagick.mosaic