code: def get_image_as_buffer(self, output=None):
          
          obuf = output
          if obuf is None:
              obuf = BytesIO()
  
          arr8 = self.get_image_as_array()
          if not hasattr(arr8, 'tobytes'):
              # older versions of numpy
              obuf.write(arr8.tostring(order='C'))
          else:
              obuf.write(arr8.tobytes(order='C'))
  
          ## if output is not None:
          ##     return None
          return obuf
docs: Get the current image shown in the viewer, with any overlaid
          graphics, in a IO buffer with channels as needed and ordered
          by the back end widget.
  
          This can be overridden by subclasses.
  
          Parameters
          ----------
          output : a file IO-like object or None
              open python IO descriptor or None to have one created
  
          Returns
          -------
          buffer : file IO-like object
              This will be the one passed in, unless `output` is None
              in which case a BytesIO obejct is returned