doResize
@param string destination
@param int width
@param int height
@param int cropX [cropX=0]
@param int cropY [cropY=0]
@param mixed ratio [ratio=null]
@param boolean resized [resized=false]

@return boolean
513138
public function doResize($destination, $size, $cropX=0, $cropY=0, $resized=false)
    {
        if (($resource = $this->getResource()) == null) {
            return false;
        }

        $image     = imagecreatetruecolor($size['width'], $size['height']);
        $imageCopy = false;

        if ($resized) {
            $imageCopy = imagecopyresized($image, $resource, 0, 0, $cropX, $cropY, $size['width'], $size['height'], $size['width'], $size['height']);
        }
        else {
            $imageCopy = imagecopyresampled($image, $resource, 0, 0, $cropX, $cropY, $size['width'], $size['height'], $this->sourceWidth, $this->sourceHeight);
        }


        if ($imageCopy) {
            if ($this->save($image, $destination)) {
                imagedestroy($image);

                return true;
            }
            else {
                imagedestroy($image);

                return false;
            }
        }
        else {
            imagedestroy($image);

            return false;
        }
    }
135836
function cropImage( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData )
    {
        $width = $filterData['data'][0];
        $height = $filterData['data'][1];
        $x = $filterData['data'][2];
        $y = $filterData['data'][3];
        $imageWidth = ImageSX( $imageObject );
        $imageHeight = ImageSY( $imageObject );
        $width = max( min( $width, $imageWidth - $x ), 0 );
        $height = max( min( $height, $imageHeight - $y ), 0 );
        $destinationGeometry = $this->createGeometry( $width, $height, 0, 0 );
        $geometry = $this->createGeometry( $width, $height, $x, $y );
        return $this->imageCopy( $imageObject,
                                 $destinationGeometry,
                                 $geometry,
                                 $sourceMimeData, $destinationMimeData );
    }
111727
public function defineSize($width, $height, $ratio = null)
    {
        $ratio = !is_null($ratio) ? $ratio : $this->ratio;

        if ($this->ratio == self::RATIO_HEIGHT)
            return $this->resizeRect($this->sourceWidth, $this->sourceHeight, $width, $height, 'height');
        elseif ($this->ratio == self::RATIO_WIDTH)
            return $this->resizeRect($this->sourceWidth, $this->sourceHeight, $width, $height);
        else
            return array('width' => $width, 'height' => $height);
    }
657041
function resizeMixin(decl, i) {
  if (decl.prop == 'resize' && decl.value !== 'none') {
    var count = 0
    decl.parent.walkDecls(function(decl) {
      if (decl.prop == 'overflow') count++
    })
    if (count === 0) {
      var reBefore = decl.raws.before.replace(reBLANK_LINE, '$1')

      insertDecl(decl, i, {
        raws: {
          before: reBefore
        },
        prop: 'overflow',
        value: 'auto'
      })
    }
  }
}
1104641
public function do_crop($width, $height, $offsetX = 0, $offsetY = 0)
    {
        return $this->_handler->do_crop($width, $height, $offsetX, $offsetY);
    }
259117
public function resizeCrop()
    {
        $sourceDimension = $this->sourceImageFile->getDimension();
        $resampleDimension = $this->resampleImageFile->getDimension();

        //try max width first...
        $resizeRatio = $resampleDimension->getWidth() / $sourceDimension->getWidth();
        $resizeWidth = $resampleDimension->getWidth();
        $resizeHeight = $sourceDimension->getHeight() * $resizeRatio;

        //if that didn't work
        if ($resizeHeight > $resampleDimension->getHeight()) {
            $resizeRatio = $resampleDimension->getHeight() / $sourceDimension->getHeight();
            $resizeHeight = $resampleDimension->getHeight();
            $resizeWidth = $sourceDimension->getWidth() * $resizeRatio;
        }

        $resampleImageResource =& $this->getResampleImageResource();

        if ($resampleDimension->getOrientation() === 'SQUARE') {
            if ($resampleImageResource->resizeImage($resizeWidth, $resizeHeight, \Imagick::FILTER_LANCZOS, 0.9,
                true)
            ) {
                $resampleAxis = new Dimension\Axis(
                    ($resizeWidth - $resampleDimension->getWidth()) / 2,
                    ($resizeHeight - $resampleDimension->getWidth()) / 2
                );
            }
        } else {
            switch ($resampleDimension->getFocus()) {
                default:
                case 'CENTER':
                    $resampleAxis = new Dimension\Axis(
                        ($sourceDimension->getWidth() / 2) - ($resizeWidth / 2),
                        ($sourceDimension->getHeight() / 2) - ($resizeHeight / 2)
                    );
                    break;
                case 'NORTH':
                    $resampleAxis = new Dimension\Axis(
                        ($sourceDimension->getWidth() - $resizeWidth) / 2,
                        0
                    );
                    break;
                case 'NORTHWEST':
                    $resampleAxis = new Dimension\Axis(
                        0,
                        0
                    );
                    break;
                case 'NORTHEAST':
                    $resampleAxis = new Dimension\Axis(
                        $sourceDimension->getWidth() - $resizeWidth,
                        0
                    );
                    break;
                case 'SOUTH':
                    $resampleAxis = new Dimension\Axis(
                        ($sourceDimension->getWidth() - $resizeWidth) / 2,
                        $sourceDimension->getHeight() - $resizeHeight
                    );
                    break;
                case 'SOUTHWEST':
                    $resampleAxis = new Dimension\Axis(
                        0,
                        $sourceDimension->getHeight() - $resizeHeight
                    );
                    break;
                case 'SOUTHEAST':
                    $resampleAxis = new Dimension\Axis(
                        $sourceDimension->getWidth() - $resizeWidth,
                        $sourceDimension->getHeight() - $resizeHeight
                    );
                    break;
                case 'WEST':
                    $resampleAxis = new Dimension\Axis(
                        0,
                        ($sourceDimension->getHeight() - $resizeHeight) / 2
                    );
                    break;
                case 'EAST':
                    $resampleAxis = new Dimension\Axis(
                        $sourceDimension->getWidth() - $resizeWidth,
                        ($sourceDimension->getHeight() - $resizeHeight) / 2
                    );
                    break;
            }

            if ( ! $resampleImageResource->resizeImage(
                $sourceDimension->getWidth(),
                $sourceDimension->getHeight(),
                \Imagick::FILTER_CATROM, 0.9, true)
            ) {
                return false;
            }
        }

        if (isset($resampleAxis)) {
            return $this->crop($resampleDimension->withAxis($resampleAxis));
        }

        return false;
    }
260761
public function reSize($width = 0, $height = 0)
    {
        $this->gdExtensionCheck();
        $dosya = $this->getFilePath();
        list($genislik, $yukseklik) = getimagesize($dosya);


        if (strstr($width, "%")) {
            $width = str_replace("%", "", $width);
            $bolw = (100 / $width);
            $width = ($genislik / $bolw);
        }
        if (strstr($height, "%")) {
            $height = str_replace("%", "", $height);
            $bolh = (100 / $height);
            $height = ($yukseklik / $bolh);
        }
        $hedef = imagecreatetruecolor($width, $height);


        switch ($this->getExt()) {
            case 'png':
                $kaynak = imagecreatefrompng($dosya);
                unlink($dosya);
                imagecopyresampled($hedef, $kaynak, 0, 0, 0, 0, $width, $height, $genislik, $yukseklik);
                imagepng($hedef, $dosya, 100);
                break;
            case 'jpg':
                $kaynak = imagecreatefromjpeg($dosya);
                unlink($dosya);
                imagecopyresampled($hedef, $kaynak, 0, 0, 0, 0, $width, $height, $genislik, $yukseklik);
                imagejpeg($hedef, $dosya, 100);
                break;
            case 'gif':
                $kaynak = imagecreatefromgif($dosya);
                unlink($dosya);
                imagecopyresampled($hedef, $kaynak, 0, 0, 0, 0, $width, $height, $genislik, $yukseklik);
                imagegif($hedef, $dosya, 100);
                break;
        }
        imagedestroy($hedef);
        imagedestroy($kaynak);

        return $this;
    }
674163
public function resize($width, $height, $ratio = false, $interlace = false) {

		$image = ['width' => imagesx($this -> image), 'height' => imagesy($this -> image)];

		//Set width and height
		if($height == 0 && $width > 0) {
			$height = round($image['height'] / ($image['width'] / $width), 0);
		}
		elseif($width == 0 && $height > 0) {
			$width = round($image['width'] / ($image['height'] / $height), 0);
		}

		$x = 0;
		$y = 0;

		//Ratio
		if(true === $ratio) {

			$ratio 		= [$image['width'] / $image['height'], $width / $height];
			$tmp_width 	= $image['width'];
			$tmp_height = $image['height'];

			if($ratio[0] > $ratio[1]) {

				$image['width'] = $image['height'] * $ratio[1];
				$x = ($tmp_width - $image['width']) / 2;
			}
			elseif($ratio[0] < $ratio[1]) {

				$image['height'] = $image['width'] / $ratio[1];
				$y = ($tmp_height - $image['height']) / 2;
			}
		}

		//Resizing
		return $this -> createImage($x, $y, $image['width'], $image['height'], $width, $height, $interlace);
	}
345545
public function crop($width = null, $height = null)
    {
        //get the source width and height
        $orgWidth = imagesx($this->resource);
        $orgHeight = imagesy($this->resource);

        //set the width if none is defined
        if (is_null($width)) {
            $width = $orgWidth;
        }

        //set the height if none is defined
        if (is_null($height)) {
            $height = $orgHeight;
        }

        //if the width and height are the same as the originals
        if ($width == $orgWidth && $height == $orgHeight) {
            //there's no need to process
            return $this;
        }

        //if we are here then we do need to crop
        //create the new resource with the width and height
        $crop = imagecreatetruecolor($width, $height);

        //set some defaults
        $xPosition = 0;
        $yPosition = 0;

        //if the width is greater than the original width
        //or if the height is greater than the original height
        if ($width > $orgWidth || $height > $orgHeight) {
            //save the destination width and height
            //because they will change here
            $newWidth = $width;
            $newHeight = $height;

            //if the desired height is larger than the desired width
            if ($height > $width) {
                //and adjust the height instead
                $height = $this->getHeightAspectRatio($orgWidth, $orgHeight, $width);
                //if the aspect height is bigger than the desired height
                if ($newHeight > $height) {
                    //set it back to the desired height
                    $height = $newHeight;
                    //and adjust the width instead
                    $width = $this->getWidthAspectRatio($orgWidth, $orgHeight, $height);
                    //now because of the way GD renders we need to find the ratio of desired
                    //height if it was brought down to the original height
                    $rWidth = $this->getWidthAspectRatio($newWidth, $newHeight, $orgHeight);
                    //set the x Position of the source to the center of the
                    //original width image width minus half the rWidth width
                    $xPosition = ($orgWidth / 2) - ($rWidth / 2);
                } else {
                    //now because of the way GD renders we need to find the ratio of desired
                    //height if it was brought down to the original height
                    $rHeight = $this->getHeightAspectRatio($newWidth, $newHeight, $orgWidth);
                    //set the y Position of the source to the center of the
                    //new sized image height minus half the desired height
                    $yPosition = ($orgHeight / 2) - ($rHeight / 2) ;
                }
            //if the desired height is smaller than the desired width
            } else {
                //get the width aspect ratio
                $width = $this->getWidthAspectRatio($orgWidth, $orgHeight, $height);
                //if the aspect height is bigger than the desired height
                if ($newWidth > $width) {
                    //set it back to the desired height
                    $width = $newWidth;
                    //and adjust the width instead
                    $height = $this->getHeightAspectRatio($orgWidth, $orgHeight, $width);
                    //now because of the way GD renders we need to find the ratio of desired
                    //height if it was brought down to the original height
                    $rHeight = $this->getHeightAspectRatio($newWidth, $newHeight, $orgWidth);
                    //set the y Position of the source to the center of the
                    //new sized image height minus half the desired height
                    $yPosition = ($orgHeight / 2) - ($rHeight / 2) ;
                } else {
                    //now because of the way GD renders we need to find the ratio of desired
                    //height if it was brought down to the original height
                    $rWidth = $this->getWidthAspectRatio($newWidth, $newHeight, $orgHeight);
                    //set the x Position of the source to the center of the
                    //original width image width minus half the rWidth width
                    $xPosition = ($orgWidth / 2) - ($rWidth / 2);
                }
            }
        } else {
            //if the width is less than the original width
            if ($width < $orgWidth) {
                //set the x Position of the source to the center of the
                //original image width minus half the desired width
                $xPosition = ($orgWidth / 2) - ($width / 2);
                //set the destination width to be the original width
                $width = $orgWidth;
            }

            //if the height is less than the original height
            if ($height < $orgHeight) {
                //set the y Position of the source to the center of the
                //original image height minus half the desired height
                $yPosition = ($orgHeight / 2) - ($height / 2);
                //set the destination height to be the original height
                $height = $orgHeight;
            }
        }

        //render the image
        imagecopyresampled($crop, $this->resource, 0, 0, $xPosition, $yPosition, $width, $height, $orgWidth, $orgHeight);

        //destroy the original resource
        imagedestroy($this->resource);

        //assign the new resource
        $this->resource = $crop;

        return $this;
    }
550615
public function cropAndResizeFromCenter($width, $height)
        {
            $this->resizeOut($width, $height);
            $this->cropFromCenter($width, $height);

            return $this;
        }
565087
protected function resizeCrop()
    {
        $sourceDimension = $this->sourceImageFile->getDimension();
        $resampleDimension = $this->resampleImageFile->getDimension();

        //try max width first...
        $resizeRatio = $resampleDimension->getWidth() / $sourceDimension->getWidth();
        $resizeWidth = $resampleDimension->getWidth();
        $resizeHeight = $sourceDimension->getHeight() * $resizeRatio;

        //if that didn't work
        if ($resizeHeight > $resampleDimension->getHeight()) {
            $resizeRatio = $resampleDimension->getHeight() / $sourceDimension->getHeight();
            $resizeHeight = $resampleDimension->getHeight();
            $resizeWidth = $sourceDimension->getWidth() * $resizeRatio;
        }

        $resampleImageResource =& $this->getResampleImageResource();

        if ($resampleDimension->getOrientation() === 'SQUARE') {

            try {

                $resampleImageResource->resizeimage($resizeWidth, $resizeHeight, \Gmagick::FILTER_LANCZOS, 0.9, false);
                $resampleAxis = new Dimension\Axis(
                    ($resizeWidth - $resampleDimension->getWidth()) / 2,
                    ($resizeHeight - $resampleDimension->getWidth()) / 2
                );

            } catch (\GmagickException $e) {

                $this->errors[ $e->getCode() ] = $e->getMessage();

                return false;

            }
        } else {
            switch ($resampleDimension->getFocus()) {
                default:
                case 'CENTER':
                    $resampleAxis = new Dimension\Axis(
                        ($sourceDimension->getWidth() / 2) - ($resizeWidth / 2),
                        ($sourceDimension->getHeight() / 2) - ($resizeHeight / 2)
                    );
                    break;
                case 'NORTH':
                    $resampleAxis = new Dimension\Axis(
                        ($sourceDimension->getWidth() - $resizeWidth) / 2,
                        0
                    );
                    break;
                case 'NORTHWEST':
                    $resampleAxis = new Dimension\Axis(
                        0,
                        0
                    );
                    break;
                case 'NORTHEAST':
                    $resampleAxis = new Dimension\Axis(
                        $sourceDimension->getWidth() - $resizeWidth,
                        0
                    );
                    break;
                case 'SOUTH':
                    $resampleAxis = new Dimension\Axis(
                        ($sourceDimension->getWidth() - $resizeWidth) / 2,
                        $sourceDimension->getHeight() - $resizeHeight
                    );
                    break;
                case 'SOUTHWEST':
                    $resampleAxis = new Dimension\Axis(
                        0,
                        $sourceDimension->getHeight() - $resizeHeight
                    );
                    break;
                case 'SOUTHEAST':
                    $resampleAxis = new Dimension\Axis(
                        $sourceDimension->getWidth() - $resizeWidth,
                        $sourceDimension->getHeight() - $resizeHeight
                    );
                    break;
                case 'WEST':
                    $resampleAxis = new Dimension\Axis(
                        0,
                        ($sourceDimension->getHeight() - $resizeHeight) / 2
                    );
                    break;
                case 'EAST':
                    $resampleAxis = new Dimension\Axis(
                        $sourceDimension->getWidth() - $resizeWidth,
                        ($sourceDimension->getHeight() - $resizeHeight) / 2
                    );
                    break;
            }

            try {

                $resampleImageResource->resizeimage($sourceDimension->getWidth(), $sourceDimension->getHeight(),
                    \Gmagick::FILTER_CATROM, 0.9, true);

            } catch (\GmagickException $e) {

                $this->errors[ $e->getCode() ] = $e->getMessage();

            }
        }

        return $this->crop($resampleDimension->withAxis($resampleAxis));
    }
936540
public function resize(int $width = 0, int $height = 0)
    {
        if (!$width && !$height) {
            throw new ImageException('You must supply at least one dimension');
        }
        $iw = $this->info[0];
        $ih = $this->info[1];
        if (!$height || !$width) {
            if (!$width) {
                $width  = $height / $ih * $iw;
            }
            if (!$height) {
                $height = $width  / $iw * $ih;
            }
        }
        $di = imagecreatetruecolor($width, $height);
        imagecopyresized($di, $this->data, 0, 0, 0, 0, $width, $height, $iw, $ih);
        $this->data = $di;
    }
301467
public static function getResizeSize($originalSize, $transform, $allowUpscale): Box
    {
        $width = $originalSize->getWidth();
        $height = $originalSize->getHeight();
        $aspect = $width / $height;

        $mode = isset($transform['mode']) ? mb_strtolower($transform['mode']) : 'crop';

        if ($mode === 'crop' || $mode === 'fit' || $mode === 'letterbox') {

            if (isset($transform['width'], $transform['height'])) {
                $transformAspect = (int)$transform['width'] / (int)$transform['height'];

                if ($mode === 'crop') {
                    $cropZoomFactor = self::getCropZoomFactor($transform);

                    if ($transformAspect < $aspect) { // use height as guide
                        $height = (int)$transform['height'] * $cropZoomFactor;
                        $width = ceil($originalSize->getWidth() * ($height / $originalSize->getHeight()));
                    } else { // use width
                        $width = (int)$transform['width'] * $cropZoomFactor;
                        $height = ceil($originalSize->getHeight() * ($width / $originalSize->getWidth()));
                    }
                } else {
                    if ($transformAspect === $aspect) { // exactly the same, use original just to make sure no rounding errors happen
                        $height = (int)$transform['height'];
                        $width = (int)$transform['width'];
                    } else if ($transformAspect > $aspect) { // use height as guide
                        $height = (int)$transform['height'];
                        $width = ceil($originalSize->getWidth() * ($height / $originalSize->getHeight()));
                    } else { // use width
                        $width = (int)$transform['width'];
                        $height = ceil($originalSize->getHeight() * ($width / $originalSize->getWidth()));
                    }
                }
            } else {
                if (isset($transform['width'])) {
                    $width = (int)$transform['width'];
                    $height = ceil($width / $aspect);
                } else if (isset($transform['height'])) {
                    $height = (int)$transform['height'];
                    $width = ceil($height * $aspect);
                }
            }
        } else {
            if ($mode === 'croponly') {
                $width = $originalSize->getWidth();
                $height = $originalSize->getHeight();
            } else if ($mode === 'stretch') {
                $width = (int)$transform['width'];
                $height = (int)$transform['height'];
            }
        }

        // check if we want to upscale. If not, adjust the transform here 
        if (!$allowUpscale) {
            list($width, $height) = self::enforceMaxSize((int)$width, (int)$height, $originalSize, false, self::getCropZoomFactor($transform));
        }

        try {
            $box = new Box((int)$width, (int)$height);
        } catch (InvalidArgumentException $e) {
            \Craft::error($e->getMessage(), __METHOD__);
            throw new ImagerException($e->getMessage(), $e->getCode(), $e);
        }

        return $box;
    }
1197645
function(size, callback) {
      var ratio = size.width / size.height;
      var cropPosition = {};
      var resizeWidth = width || Math.round(height * ratio);
      var resizeHeight = height || Math.round(width / ratio);

      if (crop && width && height) {
        if (ratio < width / height) {
          resizeHeight = Math.round(width / ratio);
          cropPosition = {x: 0, y: Math.round((resizeHeight - height) / 2)};
          crop = resizeHeight > height;
        } else {
          resizeWidth = Math.round(height * ratio);
          cropPosition = {x: Math.round((resizeWidth - width) / 2), y: 0};
          crop = resizeWidth > width;
        }
      }

      image
        .noProfile()
        .quality(quality)
        .resizeExact(resizeWidth, resizeHeight);

      if (crop)
        image.crop(width, height, cropPosition.x, cropPosition.y);

      image.write(thumbnailPath, callback);
    }
1059019
public function resize($crop = false)
    {
        if ($crop) {
            return $this->resizeCrop();
        } else {
            $sourceDimension = $this->sourceImageFile->getDimension();
            $resampleDimension = $this->resampleImageFile->getDimension();

            if (($sourceDimension->getWidth() <= $resampleDimension->getWidth()) && ($sourceDimension->getHeight() <= $resampleDimension->getHeight())) {
                return true;
            } //no resizing needed

            //try max width first...
            $resizeRatio = $resampleDimension->getWidth() / $sourceDimension->getWidth();
            $resizeWidth = $resampleDimension->getWidth();
            $resizeHeight = $sourceDimension->getHeight() * $resizeRatio;

            //if that didn't work
            if ($resizeHeight > $resampleDimension->getHeight()) {
                $resizeRatio = $resampleDimension->getHeight() / $sourceDimension->getHeight();
                $resizeHeight = $resampleDimension->getHeight();
                $resizeWidth = $sourceDimension->getWidth() * $resizeRatio;
            }

            if (function_exists('imagecreatetruecolor')) {
                $this->resampleImageResource = imagecreatetruecolor($resizeWidth, $resizeHeight);

                imagealphablending($this->resampleImageResource, false);
                imagesavealpha($this->resampleImageResource, true);

                $transparent = imagecolorallocatealpha($this->resampleImageResource, 255, 255, 255, 127);
                imagefilledrectangle($this->resampleImageResource, 0, 0, $resampleDimension->getWidth(),
                    $resampleDimension->getHeight(), $transparent);

                return imagecopyresampled(
                    $this->resampleImageResource,
                    $this->sourceImageResource,
                    0,
                    0,
                    0,
                    0,
                    $resizeWidth,
                    $resizeHeight,
                    $sourceDimension->getWidth(),
                    $sourceDimension->getHeight()
                );
            } else {
                $this->resampleImageResource = imagecreate($resampleDimension->getWidth(),
                    $resampleDimension->getHeight());

                imagealphablending($this->resampleImageResource, false);
                imagesavealpha($this->resampleImageResource, true);

                $transparent = imagecolorallocatealpha($this->resampleImageResource, 255, 255, 255, 127);
                imagefilledrectangle($this->resampleImageResource, 0, 0, $resampleDimension->getWidth(),
                    $resampleDimension->getHeight(), $transparent);

                return imagecopyresampled(
                    $this->resampleImageResource,
                    $this->sourceImageResource,
                    0,
                    0,
                    0,
                    0,
                    $resizeWidth,
                    $resizeHeight,
                    $sourceDimension->getWidth(),
                    $sourceDimension->getHeight()
                );
            }
        }
    }
31139
public function resize($newWidth, $newHeight, $crop = true)
    {
        list($width, $height) = $this->getDimensions($newWidth, $newHeight, $crop = true);
        $this->imageResized = imagecreatetruecolor($width, $height);

        imagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);

        if ($crop === true) {
            $this->crop($width, $height, $newWidth, $newHeight);
        }

        return $this;
    }
170664
public static void resizingBehaviorApply(ResizingBehavior behavior, RectF rect, RectF target, RectF result) {
    if (rect.equals(target) || target == null) {
      result.set(rect);
      return;
    }

    if (behavior == ResizingBehavior.Stretch) {
      result.set(target);
      return;
    }

    float xRatio = Math.abs(target.width() / rect.width());
    float yRatio = Math.abs(target.height() / rect.height());
    float scale = 0f;

    switch (behavior) {
      case AspectFit: {
        scale = Math.min(xRatio, yRatio);
        break;
      }
      case AspectFill: {
        scale = Math.max(xRatio, yRatio);
        break;
      }
      case Center: {
        scale = 1f;
        break;
      }
      default:
        break;
    }

    float newWidth = Math.abs(rect.width() * scale);
    float newHeight = Math.abs(rect.height() * scale);
    result.set(target.centerX() - newWidth / 2,
      target.centerY() - newHeight / 2,
      target.centerX() + newWidth / 2,
      target.centerY() + newHeight / 2);
  }