Image module
The gamebeye.gbcamimage module is as its name indicates focused on Game Boy Camera image.
Each borderless image has a 128x112 pixels resolution and uses a 4-color palette (grayscale values, natively).
Define the GBCamImage class.
- class gamebeye.gbcamimage.GBCamImage
Bases:
object
The base class of Game Boy Camera images.
A Game Boy Camera image is a nothing but a 4-colors 128x112 array.
- BORDER: int = 16
- CHANNEL: int = 3
- HEIGHT: int = 128
- NB_COLORS: int = 4
- WIDTH: int = 112
- change_color(color_palette: GBColorPalettes = GBColorPalettes.BW) NoReturn
Change the color palette with a new one from GBColorPalettes values.
- Raises:
TypeError – The color parameter must be a GBColorPalettes.
- Parameters:
color_palette – the color palette to apply
- Type:
a GBColorPalettes value
- property color_palette: GBColorPalettes
Return the GBColorPalette of the image.
- Returns:
a GBColorPalette value
- Return type:
- property data: ndarray
Property to return the image data as a numpy array.
- Returns:
the image data
- Return type:
numpy.ndarray
- read(image_filepath: str) NoReturn
Open filepath to read the file contents to populate the object.
Read filepath content, change color to GBColorPalettes.BW if unknown.
- Raises:
FileNotFoundError – The input filepath must exist to be read
ValueError – The read image is a standard Game Boy Camera Image.
- Parameters:
image_filepath (a string) – filepath to image
- property shape: Tuple[int, int, int]
Property to return the GBCamImage shape.
- Returns:
the image shape
- Return type:
tuple