Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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