class_docstr: Helper to grab a series of screenshots from the current Canvas-like object.
code: def _qpixmap_to_ndarray(pixmap):
      from PyQt5 import QtGui
      import numpy as np
  
      im = pixmap.toImage().convertToFormat(
          QtGui.QImage.Format.Format_RGB32
      )
      size = pixmap.size()
      width = size.width()
      height = size.height()
      im_bits = im.constBits()
      im_bits.setsize(height * width * 4)
      # Convert 0xffRRGGBB buffer -> (B, G, R, 0xff) -> (R, G, B)
      return np.array(im_bits).reshape((height, width, 4))[:, :, 2::-1]
  
imports: from __future__ import annotations
  import os
  import time
  import shutil
  from vispy.io import imsave
  from vispy.gloo.util import _screenshot
  from vispy.scene import SceneCanvas
  from sphinx_gallery.scrapers import optipng, figure_rst
label_desc: Use image node_id 8 for calling the FrameGrabber obj's underlying member method code with example usage: obj._qpixmap_to_ndarray(pixmap) and returns: np