Skip to content

Commit

Permalink
synthetic image generator encodes images to base64
Browse files Browse the repository at this point in the history
  • Loading branch information
mwawrzos committed Jul 12, 2024
1 parent d64cd27 commit 6d5b4ea
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,21 @@ def build_synthetic_image_generator(
mean_size: Tuple[int, int],
dimensions_stddev: Tuple[int, int],
image_path: Optional[Path] = None,
formats: List[ImageFormat] = [ImageFormat.PNG],
):
if image_path is None:
image_iterator = white_images_generator()
else:
image_path = cast(Path, image_path)
image_iterator = images_from_file_generator(image_path)

return SyntheticImageGenerator(
image_generator = SyntheticImageGenerator(
mean_size=mean_size,
dimensions_stddev=dimensions_stddev,
image_iterator=image_iterator,
)
base64_encode = RandomFormatBase64Encoder(formats)
return (base64_encode(image) for image in image_generator)


class SyntheticImageGenerator:
Expand Down

0 comments on commit 6d5b4ea

Please sign in to comment.