Module memedb_core::jpeg

source ·
Expand description

Joint Photographic Experts Group

JPEG data is separated by markers. Markers start with a sequence of one or more 0xFF bytes, followed by a second byte that identifies the marker.

  1. Some markers are followed by no further data.
  2. Some markers comprise marker segments, which are followed by a 2 byte length field followed by the segment data.
  3. Some markers are followed by entropy-coded data, which have to be slogged through byte by byte until a 0xFF byte is found that isn’t followed by 0x00, which marks the beggining of another marker.

There are some constraints on the order of the markers:

  • The first marker must be 0xD8.
  • On JFIF files, the second marker segment must be 0xE0 with the id JFIF.
  • On Exif files, the second marker segment must be 0xE1 with the id Exif.
  • The last marker must be 0xD9.

MemeDB stores its tags in a 0xE4 segment with the id MemeDB.

Functions

  • Given a src, return the tags contained inside.
  • Read data from src, set the provided tags, and write to dest.