protected function resizeImage(array $format, Imagick $image)
    {
        $maxWidth = array_key_exists('max_width', $format)? $format['max_width']: $this->maxWidth;
        $maxHeight = array_key_exists('max_height', $format)? $format['max_height']: $this->maxHeight;
        if ($maxWidth > $this->maxWidth) {
            $maxWidth = $this->maxWidth;
        }
        if ($maxHeight > $this->maxHeight) {
            $maxHeight = $this->maxHeight;
        }

        $image->setimagebackgroundcolor('#000000');
        $image->resizeImage($maxWidth, $maxHeight, Imagick::FILTER_LANCZOS, 1, true);

        return $image;
    }