gamebeye.gbcamimage 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).

Original Game Boy Camera Image

Borderless Game Boy Camera Image
GBCamImage
class
- class gamebeye.gbcamimage.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
- add_border() NoReturn
Add Nintendo border to image.
- 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:
- convert_to_palette(src_color_palette: List[List[int]], dest_color_palette: GBColorPalettes) NoReturn
Convert the data to the nearest GBColorPalettes.
- Parameters:
src_color_palette (List of List of int) – original color palatte
dest_color_palette (GBColorPalettes) – final GBColorPalettes
- Returns:
the final color palette in the BGR color space
- Return type:
List of List of int
- property data: ndarray
Property to return the image data as a numpy array.
- Returns:
the image data
- Return type:
numpy.ndarray
- static from_file(image_filepath: str) Self
Construct a GBCamImage from a filepath.
Read and convert the image color to the closest GBColorPalettes, and act like read method with convert parameter passed to True.
- Parameters:
image_filepath (a string) – filepath to image
- Returns:
a GBCamImage read from the image_filepath
- Return type:
>>> from gamebeye.gbcamimage.gbcamimage import GBCamImage >>> gb_cam_image = GBCamImage.from_file('images\\originalImage.jpg')
- property has_border: bool
Property to return if the GBCamImage has a border.
- Returns:
the possesion of a border
- Return type:
bool
- invert_color() NoReturn
Invert the color palette of the image.
- random_palette() NoReturn
Change image color to a random GBColorPalette.
- read(image_filepath: str, convert: bool = False, remove_border: bool = False) 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
convert (bool) – turn on color convertion to the closest GBColorPalette
- remove_boder() NoReturn
Remove Nintendo border from image.
Some images from Game Boy Camera may contain a Nintendo border, this method remove it.
- property shape: Tuple[int, int, int]
Property to return the GBCamImage shape.
- Returns:
the image shape
- Return type:
tuple
- to_thermal_printer() ndarray
Emulate a GB thermal printer and return a printed-on-paper image.
- Returns:
the printed image
- Return type:
np.ndarray
Thermal printed image
gbcamfilters
module
Define filters to apply to GBCamImage object.
- gamebeye.gbcamimage.gbcamfilters.invert_color(src: GBCamImage) ndarray
Invert the color palette of the image.
- Parameters:
src – A Game Boy Camera Image
- Type:
- Returns:
the printed image
- Return type:
np.ndarray
- gamebeye.gbcamimage.gbcamfilters.to_thermal_printer(src: GBCamImage) ndarray
Emulate a GB thermal printer and return a printed-on-paper image.
- Parameters:
src – A Game Boy Camera Image
- Type:
- Returns:
the printed image
- Return type:
np.ndarray
Thermal printed image
filter_helpers
module
Define filter-related unitary methods.
- gamebeye.gbcamimage.filter_helpers.generate_hstripes(size: Tuple[int, int]) ndarray
Generate an image with horizontal stripes.
- Parameters:
size (tuple of two int) – Size of the output image
- Returns:
the striped image
- Return type:
np.ndarray
- gamebeye.gbcamimage.filter_helpers.generate_vstripes(size: Tuple[int, int]) ndarray
Generate an image with vertical stripes.
- Parameters:
size (tuple of two int) – Size of the output image
- Returns:
the striped image
- Return type:
np.ndarray