Utilities

Utilities

Utility and helper functions for working with 🌍 Diffusers.

numpy_to_pil

diffusers.utils.numpy_to_pil

<source>

( images )

Convert a numpy image or a batch of images to a PIL image.

pt_to_pil

diffusers.utils.pt_to_pil

<source>

( images )

Convert a torch image to a PIL image.

load_image

diffusers.utils.load_image

<source>

( image: typing.Union[str, PIL.Image.Image] ) → PIL.Image.Image

Parameters

  • image (str or PIL.Image.Image) — The image to convert to the PIL Image format.

Returns

PIL.Image.Image

A PIL Image.

Loads image to a PIL Image.

export_to_gif

diffusers.utils.export_to_gif

<source>

( image: typing.List[PIL.Image.Image]output_gif_path: str = None )

export_to_video

diffusers.utils.export_to_video

<source>

( video_frames: typing.List[numpy.ndarray]output_video_path: str = None )

make_image_grid

diffusers.utils.make_image_grid

<source>

( images: typing.List[PIL.Image.Image]rows: intcols: intresize: int = None )

Prepares a single grid of images. Useful for visualization purposes.

Last updated