\(\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.
Format String ( |
Tuple Index |
||||
---|---|---|---|---|---|
|
|
|
|
|
|
|
Red |
Green |
Blue |
||
|
Red |
Green |
Blue |
Alpha |
|
|
Red |
Green |
Blue |
Depth |
|
|
Red |
Green |
Blue |
Alpha |
Depth |
|
Luminance |
Alpha |
|||
|
Luminance |
Depth |
|||
|
Luminance |
Alpha |
Depth |
||
|
??? \(\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.