protected function calculateResize(AbstractImage $abstractImage, $width, $height)
    {
        if (!is_numeric($width) || !is_numeric($height)) {
            throw new \LogicException('Non numeric value provide for calculating resize!');
        }

        $imageWidth = $abstractImage->getSize()->getWidth();
        $imageHeight = $abstractImage->getSize()->getHeight();

        $widthRatio = $imageWidth / (int) $width;
        $heightRatio = $imageHeight / (int) $height;
        $ratio = min($widthRatio, $heightRatio);

        if ($ratio < 1) {
            throw new ImageTooSmallException('Provided image is too small to be resize! Provide larger image.');
        }

        $calcWidth = $imageWidth / $ratio;
        $calcHeight = $imageHeight / $ratio;

        $box = clone $this->box;

        $box->setWidth(round($calcWidth))
            ->setHeight(round($calcHeight));

        return $box;
    }