code: def export(self, fileName=None, toBytes=False, copy=False):
      if fileName is None and not toBytes and not copy:
          filter = self.getSupportedImageFormats()
          self.fileSaveDialog(filter=filter)
          return
  
      w = int(self.params["width"])
      h = int(self.params["height"])
      if w == 0 or h == 0:
          raise Exception(
              "Cannot export image with size=0 (requested "
              "export size is %dx%d)" % (w, h)
          )
  
      targetRect = QtCore.QRect(0, 0, w, h)
      sourceRect = self.getSourceRect()
  
      self.png = QtGui.QImage(w, h, QtGui.QImage.Format.Format_ARGB32)
      self.png.fill(self.params["background"])
  
      ## set resolution of image:
      origTargetRect = self.getTargetRect()
      resolutionScale = targetRect.width() / origTargetRect.width()
      # self.png.setDotsPerMeterX(self.png.dotsPerMeterX() * resolutionScale)
      # self.png.setDotsPerMeterY(self.png.dotsPerMeterY() * resolutionScale)
  
      painter = QtGui.QPainter(self.png)
      # dtr = painter.deviceTransform()
      try:
          self.setExportMode(
              True,
              {
                  "antialias": self.params["antialias"],
                  "background": self.params["background"],
                  "painter": painter,
                  "resolutionScale": resolutionScale,
              },
          )
          painter.setRenderHint(
              QtGui.QPainter.RenderHint.Antialiasing,
              self.params["antialias"],
          )
          self.getScene().render(
              painter,
              QtCore.QRectF(targetRect),
              QtCore.QRectF(sourceRect),
          )
      finally:
          self.setExportMode(False)
      painter.end()
  
      if self.params["invertValue"]:
          bg = fn.ndarray_from_qimage(self.png)
          if sys.byteorder == "little":
              cv = slice(0, 3)
          else:
              cv = slice(1, 4)
          mn = bg[..., cv].min(axis=2)
          mx = bg[..., cv].max(axis=2)
          d = (255 - mx) - mn
          bg[..., cv] += d[..., np.newaxis]
  
      if copy:
          QtWidgets.QApplication.clipboard().setImage(self.png)
      elif toBytes:
          return self.png
      else:
          return self.png.save(fileName)
  
file_path: pyqtgraph/pyqtgraph/exporters/ImageExporter.py
imports: import sys
  import numpy
  from ..None import functions
  from ..parametertree import Parameter
  from ..Qt import QtCore, QtGui, QtWidgets
  from .Exporter import Exporter
label_desc: Use image node_id 6 for calling the ImageExporter obj's underlying member method code with example usage: obj.export(fileName, toBytes, copy) and returns: self, self