Service/ImageScaler/ImagineImageScaler.php
public function makeThumbnail(ImageInterface $img, Box $size)
    {
        if ($img->getSize()->getWidth() < $size->getWidth()) {
            $origSize = $img->getSize();
            $img->resize($origSize->scale($size->getWidth() / $origSize->getWidth()));
        }
        if ($img->getSize()->getHeight() < $size->getHeight()) {
            $origSize = $img->getSize();
            $img->resize($origSize->scale($size->getHeight() / $origSize->getHeight()));
        }
        return $img->thumbnail($size, ImageInterface::THUMBNAIL_OUTBOUND);
    }
public function makeThumbnail(ImageInterface $img, Box $size)
    {
        if ($img->getSize()->getWidth() < $size->getWidth()) {
            $origSize = $img->getSize();
            $img->resize($origSize->scale($size->getWidth() / $origSize->getWidth()));
        }
        if ($img->getSize()->getHeight() < $size->getHeight()) {
            $origSize = $img->getSize();
            $img->resize($origSize->scale($size->getHeight() / $origSize->getHeight()));
        }
        return $img->thumbnail($size, ImageInterface::THUMBNAIL_OUTBOUND);
    }
{@inheritdoc}