Skip to content

CharacterImage

CharacterImage(character_width, character_height, filename=None, image=None, palette=None, additional_palette=None, pixel_size=None)

Access characters from an image.

PARAMETER DESCRIPTION
character_width

width of a character in pixels

TYPE: int

character_height

height of a character in pixels

TYPE: int

filename

filename of image to load

TYPE: str | None DEFAULT: None

image

image to use

TYPE: Image | None DEFAULT: None

palette

Palette to use

TYPE: Palette | None DEFAULT: None

additional_palette

additional colors to add to palette

TYPE: dict[int | str, int | None] | list[int | str | list[int | str]] | None DEFAULT: None

pixel_size

size of logical pixels

TYPE: PixelSize | None DEFAULT: None

get(index)

Get character at given index.

PARAMETER DESCRIPTION
index

index of character to get

TYPE: int

Returns: bytes of character, or None if character is a hole

get_xy(x, y)

Get character at given coordinates.

PARAMETER DESCRIPTION
x

x coordinate of character to get

TYPE: int

y

y coordinate of character to get

TYPE: int

Returns: bytes of character, or None if character is a hole