code: def resize_image(
      file,
      dest,
      src=".",
      max_size=None,
      n_channels=3,
      ext=None,
      img_format=None,
      resample=BILINEAR,
      resume=False,
      **kwargs,
  ):
      "Resize file to dest to max_size"
      dest = Path(dest)
  
      dest_fname = dest / file
      dest_fname.parent.mkdir(exist_ok=True, parents=True)
      file = Path(src) / file
      if resume and dest_fname.exists():
          return
      if not verify_image(file):
          return
  
      img = Image.open(file)
      imgarr = np.array(img)
      img_channels = 1 if len(imgarr.shape) == 2 else imgarr.shape[2]
      if ext is not None:
          dest_fname = dest_fname.with_suffix(ext)
      if (
          max_size is not None
          and (img.height > max_size or img.width > max_size)
      ) or img_channels != n_channels:
          if max_size is not None:
              new_sz = resize_to(img, max_size)
              img = img.resize(new_sz, resample=resample)
          if n_channels == 3:
              img = img.convert("RGB")
          img.save(dest_fname, img_format, **kwargs)
      elif file != dest_fname:
          shutil.copy2(file, dest_fname)
  
file_path: fastai/fastai/vision/utils.py
imports: from __future__ import annotations
  import uuid
  from ..torch_basics import *
  from ..data.all import *
  from .core import *
  from fastdownload import download_url
  from pathlib import Path
label_desc: Use image node_id 7 for calling a global function with example usage: resize_image(file, dest, src, max_size, n_channels, ext, img_format, resample, resume) without return types