# LOAD BMP|GIF|JPG|PNG

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite CMM2

Syntax:
LOAD BMP file$ [, x, y]
LOAD GIF [file$ [, x, y]]
LOAD JPG file$ [, x, y]
LOAD PNG file$ [, x, y] [, transparency_cut_off]
LOAD IMAGE [, x, y] (Armite F4)

Description:
Load an image from the SD card and display it on the VGA monitor. ''file$' is the name of the file and 'x' and 'y' are the screen coordinates for the top left hand corner of the image.
If the coordinates are not specified the image will be drawn at the top left hand position on the screen.
If an extension is not specified the appropriate extension will be added to the file name.

All types of the BMP format are supported (except 32 bit) including black and white and true colour 24-bit images. The image can be of any size and pixels off the screen will be ignored.

GIFs can be a single image or animated. If it is animated it will start playing in the background (ie, program execution will continue while it is playing).
If an animated GIF is already running it will be replaced by the new one. If LOAD GIF is used without any parameters it will stop the currently playing animated GIF.

JPG images cannot use progressive encoding and are limited to being completely within the screen resolution (ie, pixels cannot extend beyond the screen limits).
MODE 2,16 is the optimum for displaying JPG images as the hardware decoder can write RGB565 pixels directly into the frame buffer.
For all other modes, the firmware has to adjust the image by duplicating lines (mode 3) and/or converting from RGB565 to RGB332.

PNG files must be in the RGB888 or ARGB8888 format and can be sized up to the current resolution of the screen. If the x & y start coordinates are specified pixels off the screen will be ignored.
If the transparency level is specified and none-zero then:
If a PNG file is in ARGB8888 format the 'transparency_cut_off' parameter is used to determine whether the pixel should be solid or missing/transparent.
Valid values are 1 to 15, no default. MMBasic compares the 4 most significant bits of the transparency data in the file with the cut off value and assigns a transparency of 0 or 15 depending on the comparison.
This allows RGB(0,0,0) to be a valid solid colour.
If the file is in RGB888 format then an RGB level of 0,0,0 is used to determine transparency as there is no other information to use.
If the 'transparency_cut_off' level is not specified all pixels will be loaded as solid colours as with any other image load.

LOAD IMAGE [, x, y] (Armite F4)
This is the same as LOAD BMP for the CMM2

See also SAVE IMAGE

Last edited: 25 February, 2021