euporie.core.convert.utils

Utility functions for format converters.

Functions

call_subproc(data, cmd[, use_tempfile, suffix])

Call the command as a subprocess and return it's output as bytes.

ceil(x, /)

Return the ceiling of x as an Integral.

get_app()

Get the current active (running) Application.

scale_to_fit(datum, cols, rows)

Calculate image size based on aspect ratio, and scale to fit.

Classes

Path(*args, **kwargs)

PurePath subclass that can make system calls.

async euporie.core.convert.utils.call_subproc(data: str | bytes, cmd: list[Any], use_tempfile: bool = False, suffix: str = '') bytes

Call the command as a subprocess and return it’s output as bytes.

Parameters:
  • data – The data to pass to the subprocess

  • cmd – The command and arguments to call

  • use_tempfile – If True, the command saves its output to a file, not stdout

  • suffix – Suffix for the temporary file name

Returns:

The data printed to standard out by the subprocess.

async euporie.core.convert.utils.scale_to_fit(datum: Datum, cols: int | None, rows: int | None) tuple[int, int]

Calculate image size based on aspect ratio, and scale to fit.