public function getCenter(ImageSize $size, ImageSize $cut = null) { $aSize = $size->toArray(); if (is_null($cut)) { $cut = new ImageSize(); } $aCut = $cut->toArray(); $x = round($aSize['w'] / 2); $y = round($aSize['h'] / 2); $x -= round($aCut['w'] / 2); $y -= round($aCut['h'] / 2); return new Coord2D($x, $y); }