canvas — Create a new empty image resource
Description
public static Intervention\Image\Image canvas(integer $width, integer $height, [mixed $bgcolor])
Static factory method to create a new empty image instance with given width and height. You can define a background-color. By default the canvas background is transparent.
Parameters
width
Width of the new image resource.
height
Height of the new image resource.
bgcolor (optional)
Optional Background-color of the image resource. Pass a color in one of the supported color formats or just leave it blank to get a transparent background.
Return Values
Instance of Intervention\Image\Image
Examples
// create a new empty image resource with transparent background
$img = Image::canvas(800, 600);
// create a new empty image resource with red background
$img = Image::canvas(32, 32, '#ff0000');
See also
当前内容版权归 intervention 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 intervention .