code: def to_png(self, transparent=True, thumbnail_size=None, resampling=None, in_range='dtype', out_range='dtype'):
          
          return self.to_bytes(transparent=transparent, thumbnail_size=thumbnail_size,
                               resampling=resampling, in_range=in_range, out_range=out_range)
docs: Convert to png format (discarding geo).
  
          Optionally also resizes.
          Note: for color images returns interlaced.
          :param transparent: if True - sets alpha channel for nodata pixels
          :param thumbnail_size: if not None - resize to thumbnail size, e.g. 512
          :param in_range: input intensity range
          :param out_range: output intensity range
          :param resampling: one of Resampling enums
  
          :return bytes