vendor/bundle/ruby/2.6.0/gems/ruby-vips-2.0.17/lib/vips/image.rb
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
Convert to an Array. This will be slow for large images.
Convert to an Array . This will be slow for large images .
def to_a
      memory = write_to_memory
      template = {
        char: 'c',
        uchar: 'C',
        short: 's_',
        ushort: 'S_',
        int: 'i_',
        uint: 'I_',
        float: 'f',
        double: 'd',
        complex: 'f',
        dpcomplex: 'd'
      }[format] + '*'
      array = memory.unpack(template)
      pixel_array = array.each_slice(bands).to_a
      row_array = pixel_array.each_slice(width).to_a
      return row_array
    end
def to_a memory = write_to_memory template = { char : 'c' , uchar : 'C' , short : 's_' , ushort : 'S_' , int : 'i_' , uint : 'I_' , float : 'f' , double : 'd' , complex : 'f' , dpcomplex : 'd' } [ format ] + '*' array = memory . unpack ( template ) pixel_array = array . each_slice ( bands ) . to_a row_array = pixel_array . each_slice ( width ) . to_a return row_array end
Convert to an Array.
Convert to an Array .
# we render the image to a big string, then unpack # as a Ruby array of the correct type # make the template for unpack # and unpack into something like [1, 2, 3, 4 ..] # gather band elements together # build rows
array of Fixnum
array of Fixnum
Array