\(\text{LoadImage}\)

You can use the \(\text{LoadImage}\) function to load an image into one or more matrices. Note that this function is included as part of the imagefile plug-in and requires the supplied libimagefile library to operate.

You can use the \loadimage backslash command to insert this function.

The following variants of this function are available:

  • \(\text{tuple } \text{LoadImage} \left ( \text{<filename>} \right )\)

The \(\text{<filename>}\) parameter is a text string, encoded as a tuple, holding the name of the file to be loaded.

The \(\text{LoadImage}\) function supports a relatively large number of common image formats including:

  • JPEG

  • PNG

  • GIF

  • BMP

  • TIFF

The returned value is a tuple containing a text string describing the image format followed by one or more real matrices holding the image data for each plane. Commonly returned format strings and the associated matrices are listed in Table 40.

Table 40 LoadImage Returned Tuple Members

Format String (1)

Tuple Index

2

2

3

4

5

rgb

Red

Green

Blue

rgba

Red

Green

Blue

Alpha

rgbd

Red

Green

Blue

Depth

rgbad

Red

Green

Blue

Alpha

Depth

la

Luminance

Alpha

ld

Luminance

Depth

lad

Luminance

Alpha

Depth

nonstandard

??? \(\cdots\)

The returned data will be normalized to contain values over the range [0, 1] independent of the actual encoding within the image file.

Figure 171 shows the basic use of the \(\text{LoadImage}\) function.

../_images/load_image_example.png

Figure 171 Example Use Of The LoadImage Function