Class: JXL::BasicInfo
- Inherits:
-
Data
- Object
- Data
- JXL::BasicInfo
- Defined in:
- lib/jxl/basic_info.rb
Instance Attribute Summary collapse
-
#bits_consumed ⇒ Object
readonly
Returns the value of attribute bits_consumed.
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
Instance Attribute Details
#bits_consumed ⇒ Object (readonly)
Returns the value of attribute bits_consumed
4 5 6 |
# File 'lib/jxl/basic_info.rb', line 4 def bits_consumed @bits_consumed end |
#container ⇒ Object (readonly)
Returns the value of attribute container
4 5 6 |
# File 'lib/jxl/basic_info.rb', line 4 def container @container end |
#height ⇒ Object (readonly)
Returns the value of attribute height
4 5 6 |
# File 'lib/jxl/basic_info.rb', line 4 def height @height end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
4 5 6 |
# File 'lib/jxl/basic_info.rb', line 4 def @metadata end |
#width ⇒ Object (readonly)
Returns the value of attribute 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
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 |