code: def resize_image(buf, width, height, num_channels, new_width, new_height):
      
      new_size = new_width * new_height * num_channels
      input_pixels = ffi.from_buffer(buf)
      output_pixels = ffi.new('unsigned char[]', new_size)
  
      result = lib.stbir_resize_uint8(
          ffi.cast('unsigned char*', input_pixels), width, height, 0,
          output_pixels, new_width, new_height, 0, num_channels
      )
  
      if not result:
          raise ResizeError()
  
      return ffi.buffer(output_pixels, new_size)
docs: Resize an image
  
      Args:
          buf (Buffer): Buffer coming from `load_image`
          width (int): Width of `buf`
          height (int): Height of `buf`
          num_channels (int): Number of channels in `buf` (RGBA=4)
          new_width (int): Desired width
          new_height (int): Desired height
  
      Returns:
          Buffer: Resized image
  
      Raises:
          ResizeError: If an error occurs during resize