The CVTTOBM function converts a byte array in which each byte represents one pixel into a " bitmap byte array" in which each bit represents one pixel. This is useful when creating bitmap labels for buttons created with the WIDGET_BUTTON function.
Bitmap byte arrays are monochrome; by default, CVTTOBM converts pixels that are darker than the median value to black and pixels that are lighter than the median value to white. You can supply a different threshold value via the THRESHOLD keyword.
Most of IDL's image file format reading functions (READ_BMP, READ_PICT, etc.) return a byte array which must be converted before use as a button label. Note that there is one exception to this rule; the READ_X11_BITMAP routine returns a bitmap byte array that needs no conversion before use.
This routine is written in the IDL language. Its source code can be found in the file
cvttobm.pro
in the
lib
subdirectory of the IDL distribution.