def get_image_mode()

in src/co_op_translator/utils/vision/image_utils.py [0:0]


def get_image_mode(image_path):
    """
    Determine the appropriate image mode (RGBA or RGB) based on the file extension.

    Args:
        image_path (str or Path): The path to the image file.

    Returns:
        str: 'RGBA' for PNG files, 'RGB' for JPG/JPEG files.
    """
    extension = get_filename_and_extension(image_path)[1]
    if extension in RGBA_IMAGE_EXTENSIONS:
        return "RGBA"
    elif extension in RGB_IMAGE_EXTENSIONS:
        return "RGB"
    else:
        raise ValueError(f"Unsupported image format: {extension}")