Reads an8-bit image file.
YSize The height (size in the y direction) of imgarr. YSize is computed and output if imgarr is not explicitly dimensioned. YSize is returned as an integer.
If the dimensions of the byte array imgarr are not known, DC_READ_8_BIT makes a "best guess" about the width and height of the image. It guesses by checking the number of bytes in the file and comparing that number to the number of bytes associated with the following common image sizes:
Image Width | Image Height |
---|---|
640 | 480 |
640 | 512 |
128 | 128 |
256 | 256 |
512 | 512 |
1024 | 1024 |
NOTE: You do not need to explicitly dimension imgarr, but if your image data is not one of the standard sizes shown above, you will get more predictable results if you dimension imgarr yourself.
still_life.img
is a 640-by-480 image file, the function call:
status = DC_READ_8_BIT('still_life.img', $ s_life, XSize=xdim, YSize=ydim)
still_life.img
and transfers it to a variable named s_life
. It also returns xdim=640
and ydim=480
, since these keywords were provided in the function call.On the other hand, if
still_life.img
is a 200-by-350 image file, the values returned are xdim=264
and ydim=264
. The keyword results xdim
and ydim
are computed by taking the square root of the number of bytes in the file. This conversion is done because 200-by-350 is not a "common" image size for which DC_READ_8_BIT checks.
For more information on input and output of image data, see the PV-WAVE Programmer's Guide.