Skip to content

Latest commit

 

History

History
136 lines (86 loc) · 3 KB

File metadata and controls

136 lines (86 loc) · 3 KB

Convert

Tstickers Index / Tstickers / Convert

Auto-generated documentation for tstickers.convert module.

Backend

Show source in convert.py:16

Represents different conversion libraries such as pyrlottie, and rlottie-python.

Signature

class Backend(IntEnum): ...

convertAnimated

Show source in convert.py:93

Convert animated stickers, over a number of threads, at a given framerate, scale and to a set of formats.

Arguments

  • swd Path - The sticker working directory (e.g., downloads/packName).
  • threads int - Number of threads for ProcessPoolExecutor (default: number of logical processors).
  • fps int - framerate of the converted sticker, affecting optimization and quality (default: 20)
  • scale float - Scale factor for up/downscaling images, affecting optimization and quality (default: 1). :param set[str]|None formats: Set of formats to convert telegram tgs stickers to (default: {"gif", "webp", "apng"})

Returns

Type: int Number of stickers successfully converted.

Signature

def convertAnimated(
    swd: Path,
    threads: int = multiprocessing.cpu_count(),
    fps: int = 20,
    scale: float = 1,
    backend: Backend = Backend.UNDEFINED,
    formats: set[str] | None = None,
) -> int: ...

See also

convertAnimatedFunc

Show source in convert.py:24

Convert animated stickers with (Base/Backend.UNDEFINED).

Signature

def convertAnimatedFunc(
    _swd: Path, _threads: int, _fps: int, _scale: float, _formats: set[str] | None
) -> int: ...

convertStatic

Show source in convert.py:62

Convert static stickers to specified formats.

Arguments

  • swd Path - The sticker working directory (e.g., downloads/packName).
  • threads int - Number of threads for ProcessPoolExecutor (default: number of logical processors). :param set[str]|None formats: Set of formats to convert telegram webp stickers to (default: {"gif", "png", "webp", "apng"})

Returns

Type: int Number of stickers successfully converted.

Signature

def convertStatic(
    swd: Path, threads: int = 4, formats: set[str] | None = None
) -> int: ...

convertWithPIL

Show source in convert.py:44

Convert a webp file to specified formats.

Arguments

  • input_file Path - path to the input image/ sticker :param set[str] formats: set of formats

Returns

Type: Path path of the original image/sticker file

Signature

def convertWithPIL(input_file: Path, formats: set[str]) -> Path: ...