Skip to main content

logo_image

logo_image(
team: Any,
league: str,
season: Any = None,
variant: str = 'default',
mark_type: str = 'logo',
size: int | None = None,
) -> PIL.Image.Image | None

The team's mark as a PIL image (downloaded once, then cached).

Arguments​

NameTypeDescription
teamAnyOne team identifier (abbreviation, name, ESPN id, ...).
leaguestrThe SDV league key, e.g. "nfl".
seasonAnyA season year; None picks the current mark.
variantstr"default", "dark", or a named variant from marks().
mark_typestr"logo" or "wordmark".
sizeint | NoneThe longest side in pixels. Rasters are only scaled down; SVGs are rasterized at it (default 512).

Returns​

PIL.Image.Image | None: The image, or None when the team does not resolve or has no mark.

Raises​

  • TypeError: If team is not a single value.
  • OptionalDependencyError: If the mark is an SVG and the svg extra is not installed.
  • OfflineError: If the download fails and no cached copy exists.
  • requests.HTTPError: If the CDN refuses the file (a 4xx response).
  • OSError: If the download does not match the manifest's sha256, or is not an image PIL can decode (PIL.UnidentifiedImageError subclasses OSError).
  • ValueError: If league is unknown, mark_type is not "logo"/"wordmark", or an SVG cannot be parsed.

Example​

import sdvplot

img = sdvplot.logo_image("KC", "nfl", size=64)
img.size # (64, 64)

See also​