class_docstr: **Bases:** :class:`GraphicsObject <pyqtgraph.GraphicsObject>`
class_docstr_tok: ["*","*","Bases",":","*","*",":","class",":","`","GraphicsObject","<","pyqtgraph.GraphicsObject",">","`"]
code: def _try_make_qimage(self, image, levels, lut, augmented_alpha):
      xp = self._xp
  
      ubyte_nolvl = image.dtype == xp.ubyte and levels is None
      is_passthru8 = ubyte_nolvl and lut is None
      is_indexed8 = (
          ubyte_nolvl
          and image.ndim == 2
          and lut is not None
          and lut.shape[0] <= 256
      )
      is_passthru16 = (
          image.dtype == xp.uint16 and levels is None and lut is None
      )
      can_grayscale16 = (
          is_passthru16
          and image.ndim == 2
          and hasattr(QtGui.QImage.Format, "Format_Grayscale16")
      )
      is_rgba64 = (
          is_passthru16 and image.ndim == 3 and image.shape[2] == 4
      )
  
      # bypass makeARGB for supported combinations
      supported = (
          is_passthru8 or is_indexed8 or can_grayscale16 or is_rgba64
      )
      if not supported:
          return None
  
      if self._xp == getCupy():
          image = image.get()
  
      # worthwhile supporting non-contiguous arrays
      image = numpy.ascontiguousarray(image)
  
      fmt = None
      ctbl = None
      if is_passthru8:
          # both levels and lut are None
          # these images are suitable for display directly
          if image.ndim == 2:
              fmt = QtGui.QImage.Format.Format_Grayscale8
          elif image.shape[2] == 3:
              fmt = QtGui.QImage.Format.Format_RGB888
          elif image.shape[2] == 4:
              if augmented_alpha:
                  fmt = QtGui.QImage.Format.Format_RGBX8888
              else:
                  fmt = QtGui.QImage.Format.Format_RGBA8888
      elif is_indexed8:
          # levels and/or lut --> lut-only
          fmt = QtGui.QImage.Format.Format_Indexed8
          if lut.ndim == 1 or lut.shape[1] == 1:
              ctbl = [QtGui.qRgb(x, x, x) for x in lut.ravel().tolist()]
          elif lut.shape[1] == 3:
              ctbl = [QtGui.qRgb(*rgb) for rgb in lut.tolist()]
          elif lut.shape[1] == 4:
              ctbl = [QtGui.qRgba(*rgba) for rgba in lut.tolist()]
      elif can_grayscale16:
          # single channel uint16
          # both levels and lut are None
          fmt = QtGui.QImage.Format.Format_Grayscale16
      elif is_rgba64:
          # uint16 rgba
          # both levels and lut are None
          fmt = QtGui.QImage.Format.Format_RGBA64  # endian-independent
      if fmt is None:
          raise ValueError("unsupported image type")
      qimage = fn.ndarray_to_qimage(image, fmt)
      if ctbl is not None:
          qimage.setColorTable(ctbl)
      return qimage
  
imports: import warnings
  from collections.abc import Callable
  import numpy
  from ..None import colormap
  from ..None import debug
  from ..None import functions
  from ..None import getConfigOption
  from ..Point import Point
  from ..Qt import QtCore, QtGui, QtWidgets
  from ..util.cupy_helper import getCupy
  from .GraphicsObject import GraphicsObject
label_desc: Use image node_id 32 for calling the ImageItem obj's underlying member method code with example usage: obj._try_make_qimage(image, levels, lut, augmented_alpha) and returns: qimage, None