euporie.core.widgets.display.data_pixel_size

euporie.core.widgets.display.data_pixel_size(data: Any, format_: str, fg: str | None = None, bg: str | None = None) tuple[int | None, int | None]

Get the dimensions of an image.

Foreground and background color are set at this point if they are available, as data conversion outputs are cached and re-used.

Parameters
  • data – The data to check the dimensions of

  • format – The current format of the data

  • fg – The desired foreground color of the data

  • bg – The desired background color of the data

Returns

A tuple of the data’s width in terminal columns and its aspect ratio, when

converted to a image.