How to use the lottie.parsers.tgs.parse_tgs function in lottie

To help you get started, we’ve selected a few lottie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github blueset / efb-telegram-master / efb_telegram_master / utils.py View on Github external
def convert_tgs_to_gif(tgs_file: BinaryIO, gif_file: BinaryIO) -> bool:
    # Import only upon calling the method due to added binary dependencies
    # (libcairo)
    from lottie.parsers.tgs import parse_tgs

    # noinspection PyBroadException
    try:
        animation = parse_tgs(tgs_file)
        # heavy_strip(animation)
        # heavy_strip(animation)
        # animation.tgs_sanitize()
        export_gif(animation, gif_file, skip_frames=5, dpi=48)
        return True
    except Exception:
        logging.exception("Error occurred while converting TGS to GIF.")
        return False

lottie

A framework to work with lottie files and telegram animated stickers (tgs)

AGPL-3.0
Latest version published 1 month ago

Package Health Score

64 / 100
Full package analysis