freetypy.Bitmap

class freetypy.Bitmap

A structure used to describe a bitmap or pixmap to the raster.

Bitmap supports the Python buffer interface, so it is easy to convert it to a Numpy array. For example:

>>> import numpy as np
>>> a = np.asarray(bitmap)

Attributes

buffer Get the bitmap’s contents as a buffer.
num_grays The number of gray levels used in the bitmap.
pitch The pitch’s absolute value is the number of bytes taken by one bitmap row, including padding.
pixel_mode The PIXEL_MODE, i.e., how pixel bits are stored.
rows The number of bitmap rows.
width The number of pixels in bitmap row.

Methods

convert Convert a Bitmap to 8 bits per pixel.
to_list ⨎ Convert the bitmap to a nested list.