Function graphics.newimage
returns a
drawing surface descriptor
for an offscreen image.
There are several ways to specify its arguments:
graphics.newimage(w,h)
Creates an image of width w
and height h
.
graphics.newimage(pngfile)
Creates an image by loading the contents
of the PNG file named pngfile
.
graphics.newimage(tensor)
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.