# File lib/png/reader.rb, line 51
  def self.read_IHDR data, metadata_only = false
    width, height, bit_depth, color_type, *rest = data.unpack 'N2C5'

    unless metadata_only then
      raise ArgumentError, "Wrong bit depth: #{bit_depth}" unless
        bit_depth == 8
      raise ArgumentError, "Wrong color type: #{color_type}" unless
        color_type == RGBA or color_type = RGB
      raise ArgumentError, "Unsupported options: #{rest.inspect}" unless
        rest == [0, 0, 0]
    end

    return bit_depth, color_type, width, height
  end