Reads a BMP, GIF, JPEG, PNG, TIF and other image file formats.
READIMAGE("filename", "pixformat", aspect)
"filename" |
- |
A string, the filename or URL of the image file. |
||||||||||||||||||||||||||||||||||||||||||
"pixformat" |
- |
Optional. A string, the resulting image pixel format. Defaults to "PBGRA32" (32-bit premultiplied BGRA) if omitted or empty. Supports the following pixel formats:
|
||||||||||||||||||||||||||||||||||||||||||
aspect |
- |
Optional. In integer, the image aspect ratio. Defaults to -1, preserve image natural aspect ratio. |
An array.
W1: readimage(gethome + "data\mandrill.bmp")
W2: readimage(gethome + "data\logo.gif")
W3: readimage(gethome + "data\kasha.jpg");scalesoff
W4: readimage("https://science.nasa.gov/wp-content/uploads/2023/07/saturn-1.jpg")
W1 reads and displays the bitmap file "mandrill.bmp" in the aspect ratio of the image.

W2 reads and displays the GIF file "logo.gif" in the aspect ratio of the image.

W3 reads and displays the JPEG file "kasha.jpg", in the aspect ratio of the image and the scales are removed.

W4 reads an image of the planet Saturn directly from the internet.

W1: readimage(gethome + "data\mandrill.bmp", "Gray8")
W1 reads and displays the bitmap file "mandrill.bmp" using grayscale values raning from 0 to 255.
Unless pixformat is specified, the images are automatically converted to an internal RGBIMAGE using the "PBGRA32" (32-bit premultiplied BGRA) pixel format.
The type of image is determined by the filename extension. Supported extensions include BMP, GIF, JPG, PNG and TIF. See SAVEIMAGE for a current list of supported formats.
READIMAGE supports loading of images directly from a URL.
The default aspect value of -1 causes the window aspect ratio to match the aspect ratio of the contained image. See SETASPECT for more details on the aspect ratio.