Canvases are created using one of the imagecreate* family of functions as imagecreate() (to create an empty canvas) or imagecreatefromjpeg() (to create from an existing Jpeg image) Both functions return a resource representing the canvas for that image.

<?php
    
/* Create an new 256 x 256 image canvas */
    
$img imagecreate(256256);

    
/* Create a canvas based on a jpeg */
    
$img2 imagecreatefromjpeg("/path/to/my/jpeg");
?>
GD can support the loading of a number of formats: