code: def create_thumbnail(
      image_filename, thumb_filename, window_size=(280, 160)
  ):
      """Create a thumbnail whose shortest dimension matches the window"""
      from PIL import Image
  
      im = Image.open(image_filename)
      im_width, im_height = im.size
      width, height = window_size
  
      width_factor, height_factor = width / im_width, height / im_height
  
      if width_factor > height_factor:
          final_width = width
          final_height = int(im_height * width_factor)
      else:
          final_height = height
          final_width = int(im_width * height_factor)
  
      thumb = im.resize((final_width, final_height), Image.ANTIALIAS)
      thumb.save(thumb_filename)
  
file_path: altair/sphinxext/utils.py
imports: import ast
  import hashlib
  import itertools
  import json
  import re
label_desc: Use image node_id 1 for calling a global function with example usage: create_thumbnail(image_filename, thumb_filename, window_size) without return types