Class: FormatParser::JPEGParser

Inherits:
Object
  • Object
show all
Includes:
IOUtils
Defined in:
lib/parsers/jpeg_parser.rb

Defined Under Namespace

Classes: InvalidStructure

Constant Summary collapse

SOI_MARKER =

start of image

0xD8
SOF_MARKERS =
[0xC0..0xC3, 0xC5..0xC7, 0xC9..0xCB, 0xCD..0xCF]
EOI_MARKER =

end of image

0xD9
SOS_MARKER =

start of stream

0xDA
APP1_MARKER =

maybe EXIF

0xE1
EXIF_MAGIC_STRING =
"Exif\0\0".b
MUST_FIND_NEXT_MARKER_WITHIN_BYTES =
1024

Instance Method Summary collapse

Methods included from IOUtils

#safe_read, #safe_skip

Instance Method Details

#call(io) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/parsers/jpeg_parser.rb', line 15

def call(io)
  @buf = FormatParser::IOConstraint.new(io)
  @width             = nil
  @height            = nil
  @orientation       = nil
  @intrinsics = {}
  scan
end