Function graphics.newimage returns a drawing surface descriptor for an offscreen image.

There are several ways to specify its arguments:

Creates an image of width w and height h.

Creates an image by loading the contents of the PNG file named pngfile.

Creates an image by extracting the contents of the specified torch.Tensor. Tensor tensor must have 2 or 3 dimensions. The first dimension defines the image width. The second dimension defines the image height. The third dimension size must be 1, 3, or 4 for monochrome, rgb, and rgba images respectively. Each component is a floating point number in range 0 to 1.