Skip to content

Commit

Permalink
fix import guard
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed Mar 28, 2022
1 parent b85cce7 commit 7565fab
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions src/compas/utilities/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7565fab

Please sign in to comment.