private function _getImagine(OutputInterface $output)
    {
        // Use Imagick extension by default
        if (extension_loaded('imagick') && class_exists("Imagick"))
        {
            $output->writeln('Imagick library is used!');
            return new \Imagine\Imagick\Imagine();
        }
        // fall back to GD
        if (extension_loaded('gd') && function_exists('gd_info'))
        {
            $output->writeln('GD library is used!');
            return new \Imagine\Gd\Imagine();
        }
        // Quit if can not find both extensions
        $output->writeln("<error>The `imagick` or `gd` extension must be loaded to generate image</error>");
        exit(1);
    }