code: def from_dimensions(cls, width, height, channels, filename=None,
                          grayscale=False, channel_bitdepth=8,
                          has_alpha=False, palette=None):
          
          assert 1 <= channels <= 4, "PNG only supports 1 to 4 channels per pixel. Error writing %s." % filename
  
          dimensions = (height, width, channels)
          if channels == 1:
              dimensions = (height, width)  # keep the array 2-dimensional when possible
  
          _array = numpy.zeros(dimensions, dtype=PNGWriter.get_dtype(channel_bitdepth))
          return cls(_array, filename,
                     grayscale=grayscale, channel_bitdepth=channel_bitdepth,
                     has_alpha=has_alpha, palette=palette, channels=channels)
docs: Creates an empty image according to width, height and channels.
          Channels must be 1 (grayscale/palette), 2 (LA), 3 (RGB) or 4 (RGBA).
          The image will be filled with black, transparent pixels.