def to_a
      # we render the image to a big string, then unpack
      # as a Ruby array of the correct type
      memory = write_to_memory

      # make the template for unpack
      template = {
          :char => 'c',
          :uchar => 'C',
          :short => 's_',
          :ushort => 'S_',
          :int => 'i_',
          :uint => 'I_',
          :float => 'f',
          :double => 'd',
          :complex => 'f',
          :dpcomplex => 'd'
      }[format] + '*'

      # and unpack into something like [1, 2, 3, 4 ..]
      array = memory.unpack(template)

      # gather band elements together
      pixel_array = array.each_slice(bands).to_a

      # build rows
      row_array = pixel_array.each_slice(width).to_a

      return row_array
    end
def to_a
      # we render the image to a big string, then unpack
      # as a Ruby array of the correct type
      memory = write_to_memory

      # make the template for unpack
      template = {
          :char => 'c',
          :uchar => 'C',
          :short => 's_',
          :ushort => 'S_',
          :int => 'i_',
          :uint => 'I_',
          :float => 'f',
          :double => 'd',
          :complex => 'f',
          :dpcomplex => 'd'
      }[format] + '*'

      # and unpack into something like [1, 2, 3, 4 ..]
      array = memory.unpack(template)

      # gather band elements together
      pixel_array = array.each_slice(bands).to_a

      # build rows
      row_array = pixel_array.each_slice(width).to_a

      return row_array
    end
Convert to an Array. This will be slow for large images.

 @return [Array] array of Fixnum