Utils

Utility functions for loading and processing images.

easy_pil.utils.load_image(link: str, *, raw: bool = False) Image | GifImageFile

Load image from link.

Parameters:
  • link (str) – Image link

  • raw (bool) – if you want the raw image without any conversion

Returns:

Image from the provided link (if any)

Return type:

PIL.Image.Image

async easy_pil.utils.load_image_async(link: str, session: ClientSession | None = None, *, raw: bool = False) Image | GifImageFile

Load image from link (async).

Parameters:
  • link (str) – Image from the provided link (if any)

  • session (aiohttp.ClientSession) – clientSession for making requests, defaults to None

  • raw (bool) – if you want the raw image without any conversion

Returns:

Image link

Return type:

PIL.Image.Image

async easy_pil.utils.run_in_executor(func: Callable[[...], Any], **kwargs: Any) Any

Run function in executor.