create gif
This commit is contained in:
		
							parent
							
								
									79ff5c76ec
								
							
						
					
					
						commit
						49bdcd0847
					
				| @ -5,6 +5,7 @@ import argparse | ||||
| from collections import OrderedDict | ||||
| from progress.bar import IncrementalBar | ||||
| 
 | ||||
| import imageio | ||||
| 
 | ||||
| def generate_map_timelapse(token_id, token_secret): | ||||
|     print("Getting viewings") | ||||
| @ -19,7 +20,9 @@ def generate_map_timelapse(token_id, token_secret): | ||||
|     date_viewings = OrderedDict(sorted(date_viewings.items(), key=lambda t: t[0])) | ||||
| 
 | ||||
|     running_country_counts = {} | ||||
|     print(len(date_viewings.keys())) | ||||
| 
 | ||||
|     with imageio.get_writer('test.gif', mode='I', duration=0.1) as writer: | ||||
|         for date, viewings in date_viewings.items(): | ||||
|             date_viewings_countries = VCinemaUtils.filter_viewings(viewings, "countries") | ||||
| 
 | ||||
| @ -32,6 +35,11 @@ def generate_map_timelapse(token_id, token_secret): | ||||
|             with open("map-{}.png".format(date), "wb") as f: | ||||
|                 f.write(FilmsByCountry.draw_map(running_country_counts, file_name="map-{}.svg".format(date))) | ||||
| 
 | ||||
|             image = imageio.imread("map-{}.png".format(date)) | ||||
|             writer.append_data(image) | ||||
| 
 | ||||
|     print("done") | ||||
| 
 | ||||
| 
 | ||||
| if __name__ == '__main__': | ||||
|     parser = argparse.ArgumentParser(description='Update wiki pages.') | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Sarah
						Sarah