Open profLewis opened 4 years ago
def make_icons(self,spec): ''' Use UCL icon file to make 64 x 64 and 32 x 32 logo images and store in resource dir
spec: directory to place icons
'''
resource_dir = Path(spec).expanduser()
resource_dir.mkdir(parents=True, exist_ok=True) #
# ucllogo = Path(resource_dir).joinpath('ucl_logo.png') logo3232 = Path(resource_dir).joinpath('logo-32x32.png') logo6464 = Path(resource_dir).joinpath('logo-64x64.png') url = 'https://raw.githubusercontent.com/UCL-EO/uclgeog/master/images/ucl_logo.png' try: r = requests.get(url, allow_redirects=True) open(ucllogo, 'wb').write(r.content)
image = Image.open(ucllogo)
aspect_ratio = image.size[0]/image.size[1]
big = int(aspect_ratio * 64)
image = image.resize((big,64),Image.ANTIALIAS)
new_im = Image.new('RGB',(big,big),(255, 255, 255)) # White
new_im.paste(image, image.getbbox()) # Not cent
new_im.resize((64,64),\
Image.ANTIALIAS).save(logo6464)
new_im.resize((32,32),\
Image.ANTIALIAS).save(logo3232)
return new_im
except: return None
There's a file in the home folder that allows you to use these things, need to check where this is.
Says here you need to
$NB_HOME/.jupyter/custom/
Hassle is notebook/lab interface have different ways to set this.
perfect!
A notebook logo might be cool. I've some code to generate the 32x32 and 64x64 logo files you need, but I'm not sure where to insert them, other than in the kernel directory.