Parses a JPEG image and returns its structured representation.
Walks the marker stream sequentially, producing one section per marker:
SOI – fixed 2-byte Start of Image marker.
APPn / SOFn / DHT / DQT / DRI / COM – variable-length segments with
a 2-byte big-endian length field; DQT and DHT are typed as 'data',
all others as 'metadata'.
SOS – header segment followed by a separate entropy-coded scan-data section.
EOI – End of Image marker; terminates the walk.
RST0–RST7 restart markers (no payload) are skipped silently.
Any 0xFF byte that does not introduce a recognised sequence triggers a
one-byte resync to recover from padding or corrupted streams.
Image dimensions and component count are extracted from the first SOF0–SOF3
segment encountered.
Parses a JPEG image and returns its structured representation.
Walks the marker stream sequentially, producing one section per marker:
DQTandDHTare typed as'data', all others as'metadata'.RST0–RST7 restart markers (no payload) are skipped silently. Any
0xFFbyte that does not introduce a recognised sequence triggers a one-byte resync to recover from padding or corrupted streams.Image dimensions and component count are extracted from the first SOF0–SOF3 segment encountered.