/** * Create a new image with specified width, height and color * * @param int $width The new image width in pixels * @param int $height The new image height in pixels * @param Color $color The new image color * * @return \imagemanipulation\ImageResource */ public static function create($width, $height, Color $color) { Args::int($width, 'width')->required()->min(1); Args::int($height, 'height')->required()->min(1); $res = new ImageResource(imagecreatetruecolor($width, $height)); $color = ImageUtil::allocateColor($res->getResource(), $color); imagefill($res->getResource(), 0, 0, $color); $res->saveAlpha(); return $res; }