code: def on_resize(self, event):
      width, height = event.physical_size
      gloo.set_viewport(0, 0, width, height)
      self.projection = ortho(0, width, 0, height, -100, 100)
      self.program["u_projection"] = self.projection
  
      # Compute thje new size of the quad
      r = width / float(height)
      R = W / float(H)
      if r < R:
          w, h = width, width / R
          x, y = 0, int((height - h) / 2)
      else:
          w, h = height * R, height
          x, y = int((width - w) / 2), 0
      data["a_position"] = np.array(
          [[x, y], [x + w, y], [x, y + h], [x + w, y + h]]
      )
      self.program.bind(gloo.VertexBuffer(data))
  
file_path: vispy/examples/gloo/animate_images.py
imports: import numpy
  from vispy.util.transforms import ortho
  from vispy import gloo
  from vispy import app
label_desc: Use image node_id 2 for calling the Canvas obj's underlying member method code with example usage: obj.on_resize(event) without return types