From 7565fab1827e80354dd83a36a1932b5f093fb0fa Mon Sep 17 00:00:00 2001 From: brgcode Date: Mon, 28 Mar 2022 13:27:50 +0200 Subject: [PATCH] fix import guard --- src/compas/utilities/images.py | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/compas/utilities/images.py b/src/compas/utilities/images.py index a9448606091..4a35d327e45 100644 --- a/src/compas/utilities/images.py +++ b/src/compas/utilities/images.py @@ -3,24 +3,25 @@ from __future__ import division import os +import compas -try: +if not compas.IPY: import imageio -except ImportError: - pass -__all__ = ['gif_from_images'] +__all__ = ["gif_from_images"] -def gif_from_images(files, - gif_path, - fps=10, - loop=0, - reverse=False, - pingpong=False, - subrectangles=True, - delete_files=False): +def gif_from_images( + files, + gif_path, + fps=10, + loop=0, + reverse=False, + pingpong=False, + subrectangles=True, + delete_files=False, +): """Create an animated GIF from a series of images. Parameters @@ -49,11 +50,9 @@ def gif_from_images(files, files.reverse() if pingpong: files += files[::-1] - with imageio.get_writer(gif_path, - mode='I', - fps=fps, - loop=loop, - subrectangles=subrectangles) as writer: + with imageio.get_writer( + gif_path, mode="I", fps=fps, loop=loop, subrectangles=subrectangles + ) as writer: for filename in files: image = imageio.imread(filename) writer.append_data(image)