Class: JXL::BasicInfo

Inherits:
Data
  • Object
show all
Defined in:
lib/jxl/basic_info.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#bits_consumedObject (readonly)

Returns the value of attribute bits_consumed

Returns:

  • (Object)

    the current value of bits_consumed



4
5
6
# File 'lib/jxl/basic_info.rb', line 4

def bits_consumed
  @bits_consumed
end

#containerObject (readonly)

Returns the value of attribute container

Returns:

  • (Object)

    the current value of container



4
5
6
# File 'lib/jxl/basic_info.rb', line 4

def container
  @container
end

#heightObject (readonly)

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



4
5
6
# File 'lib/jxl/basic_info.rb', line 4

def height
  @height
end

#metadataObject (readonly)

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



4
5
6
# File 'lib/jxl/basic_info.rb', line 4

def 
  @metadata
end

#widthObject (readonly)

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



4
5
6
# File 'lib/jxl/basic_info.rb', line 4

def width
  @width
end

Class Method Details

.read(data, max_pixels: 100_000_000) ⇒ Object

Raises:



5
6
7
8
9
10
11
12
13
14
# File 'lib/jxl/basic_info.rb', line 5

def self.read(data, max_pixels: 100_000_000)
  container = Container::Parser.new(data, ignore_brob: true)
  stream = container.codestream
  raise SignatureError, "invalid codestream signature" unless stream.start_with?(Container::Signature::CODESTREAM)

  reader = Bit::Reader.new(stream, 2)
  size = Headers::SizeHeader.read(reader, max_pixels:)
   = Headers::ImageMetadata.read(reader, max_pixels:)
  new(width: size.width, height: size.height, metadata:, container:, bits_consumed: reader.bits_read)
end