DC_WRITE_8_BIT Function
Writes 8-bit image data to a file.
Usage
status = DC_WRITE_8_BIT(filename, imgarr)
Input Parameters
filename — A string containing the pathname and filename of the file where the 8-bit image data is to be stored.
imgarr — The 2D byte array variable from which the 8-bit image data is transferred.
Returned Value
status — The value returned by DC_WRITE_8_BIT; expected values are:
-
< 0 — Indicates an error, such as an invalid filename.
-
0 — Indicates a successful write.
Keywords
None.
Discussion
DC_WRITE_8_BIT handles many steps that you have to do yourself when using other PV-WAVE functions and procedures. These steps include: 1) opening the file, 2) assigning it a logical unit number (LUN), and 3) closing the file when you are done writing the data.
Note: Only one 8-bit image can be stored at a time when using the DC_WRITE_8_BIT function. |
If imgarr is not a 2D byte array, DC_WRITE_8_BIT returns an error status and no data is written to the output file.
Example
If stripes
is a 600-by-400 byte array containing image data, the commands:
stripes = BYTARR(600, 400) stripes(0:99,*) = 50 stripes(100:199,*) = 100 stripes(200:299,*) = 150 stripes(300:399,*) = 200 status = DC_WRITE_8_BIT('stripes.img', stripes)
create the file stripes.img
and use it to store the image data contained in the variable stripes. The file that is created contains raw binary data, and is easily read with DC_READ_8_BIT.
See Also
DC_ERROR_MSG, DC_READ_8_BIT, DC_WRITE_24_BIT
See the PV‑WAVE Programmer’s Guide for more information about 8-bit (binary) data.