17 add colorbar to gif
Uncomment the following line to install geemap if needed.
In [ ]:
# !pip install geemap
In [ ]:
import geemap
import os
In [ ]:
# geemap.update_package()
Download a GIF¶
In [ ]:
from geemap import *
In [ ]:
url = 'https://i.imgur.com/MSde1om.gif'
out_dir = os.path.join(os.path.expanduser('~'), 'Downloads')
if not os.path.exists(out_dir):
os.makedirs(out_dir)
download_from_url(url, out_file_name='temp.gif', out_dir=out_dir)
In [ ]:
in_gif = os.path.join(out_dir, 'temp.gif')
show_image(in_gif)
Get image URLs¶
In [ ]:
noaa_logo = 'https://bit.ly/3ahJoMq'
ee_logo = 'https://bit.ly/2RJYSCo'
Set output GIF path¶
In [ ]:
out_gif = os.path.join(out_dir, 'output.gif')
Add images to GIF¶
In [ ]:
add_image_to_gif(in_gif, out_gif, in_image=noaa_logo, xy = ('2%', '80%'), image_size=(80, 80))
In [ ]:
add_image_to_gif(out_gif, out_gif, in_image=ee_logo, xy = ('13%', '79%'), image_size=(85, 85))
Display output GIF¶
In [ ]:
show_image(out_gif)
Create a colorbar¶
In [ ]:
width = 250
height = 30
palette = ['blue', 'purple', 'cyan', 'green', 'yellow', 'red']
labels = [-40, 35]
colorbar = create_colorbar(width=width, height=height, palette=palette, vertical=False,
add_labels=True, font_size=20, labels=labels)
In [ ]:
show_image(colorbar)
Add colorbar to GIF¶
In [ ]:
add_image_to_gif(out_gif, out_gif, in_image=colorbar, xy = ('69%', '89%'), image_size=(250, 250))
In [ ]:
show_image(out_gif)
Last update: 2021-02-25