Image Functions#

Here are some functions to help the manipulation of image data.

read_image(folder: Path | List[Path], resize: Tuple[int, int] | None = None, handle_errors: str = 'ignore', id_pattern: str | None = None, extensions: List = ['.png', '.jpg', '.jpeg'])#

Function to read images from folder and transform to a format compatible to jai.

Must pass the folder of the images or a list of paths for each image.

  • folder (str or Path, optional) – Path for the images folder. The default is None.

  • new_size (Tuple of int, optional) – New shape to resize images. The default is None.

  • handle_errors (str, optional) – Whether to ignore errors and skipped files. If “ignore”, could probably result in a internal error later on. The default is “ignore”.

  • id_pattern (str, optional) – regex string to find id value. The default is None.

  • extensions (List, optional) – List of acceptable extensions. The default is [“.png”, “.jpg”, “.jpeg”].


ValueError – If not passed a image folder or list of images.


Pandas Dataframe with acceptable format for jai usage.

Return type:



>>> from jai.utilities import read_image
>>> df = read_image(folder_path)