code: def resize_img(fname, targ, path, new_path, fn=None):
      
      if fn is None:
          fn = resize_fn(targ)
      dest = os.path.join(path_for(path, new_path, targ), fname)
      if os.path.exists(dest): return
      im = Image.open(os.path.join(path, fname)).convert('RGB')
      os.makedirs(os.path.split(dest)[0], exist_ok=True)
      fn(im).save(dest)
docs: Enlarge or shrink a single image to scale, such that the smaller of the height or width dimension is equal to targ.