Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2021
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 44.18 KB | None | 0 0
  1. '__main__':
  2.     path = Path(f"{Path(__file__).parent.absolute()}")
  3.     images = path.glob("*.png")
  4.     frames = []
  5.  
  6.  
  7.     for image in images:
  8.         img_file = get_processed_image(image)
  9.         img_file.save(image, "PNG")
  10.         frames.append(img_file)
  11.  
  12.     FRAME_DURATION = 300 # ДЛИТЕЛЬНОСТЬ КАЖДОГО КАДРА В МИЛЛИСЕКУНДАХ
  13.     LAST_FRAME_DURATION = 5000 # ДЛИТЕЛЬНОСТЬ ПОСЛЕДНЕГО КАДРА В МИЛЛИСЕКУНДАХ
  14.     gif_duration = [FRAME_DURATION for i in range(0, len(frames) - 1)] + [LAST_FRAME_DURATION]
  15.     frames[0].save("timelapse.gif", save_all=True, append_images=frames[1:], optimize=False, duration=gif_duration, loop=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement