Segments, Chunks, and Item Extents

Image File Structure: Following JPEG Segments, PNG Chunks, and HEIC Items

Image formats organize compressed samples, descriptive records, previews, and display instructions differently. A structural examination follows declared boundaries instead of treating every visible byte pattern as a real object.

  • Court qualified expert witnesses
  • Former law enforcement forensic examiners
  • Hash verified chain of custody
  • Nationwide support for attorneys and clients

Home › Digital Evidence Authentication › Photo and Image Authentication › Image File Structure: JPEG, PNG and HEIC Explained

Quick Answer. Image file structure is the organization of encoded pixels, metadata, and references inside a picture file. JPEG uses markers and segments, PNG uses typed chunks with checksums, and HEIC commonly uses boxes and referenced image items. Examiners validate lengths, ordering, and references before interpreting metadata or deciding whether unexplained bytes represent damage, software behavior, or concealed content.

This structural chapter of Photo and Image Authentication explains what a parser must follow to reconstruct an image and its supporting records. Start with format signatures when the extension is uncertain, then use EXIF analysis to interpret descriptive fields within the mapped container. Structure tells us where a record lives and whether it can be read reliably. It does not make the record a trustworthy statement about capture.

JPEG segment walkLength fields govern most marker payload boundaries.
PNG chunk walkEach chunk supplies length, type, data, and CRC.
HEIC extent walkItem locations can reference multiple data extents.
Display reconstructionOrientation and derived images affect the rendered result.

Image container structure questions answered

QuestionShort answer
How is JPEG file structure organized?SOI begins the stream, marker segments describe tables and frames, SOS introduces scan data, and EOI closes the codestream. Progressive images contain multiple scans.
How is PNG file structure organized?An eight byte signature precedes chunks. IHDR describes the image, IDAT carries compressed image data, and IEND closes the PNG datastream.
How is HEIC file structure organized?ISO base media boxes describe brands, image items, properties, and data locations. The primary displayed image can be a derived item built from other items.
Why do image structure parsers disagree?Readers vary in error recovery, supported features, and tolerance for extra data. An examiner resolves the disagreement against byte boundaries and format requirements.
Does image file structure reveal a crop?Sometimes. A source preview, edit metadata, or HEIC display property can preserve relevant information. A flattened export may contain only the cropped pixels.
Can image structure contain more than one picture?Yes. Previews, auxiliary images, multiple frames, or separate items can coexist. Their declared roles matter more than simply counting embedded signatures.

Key terms defined

SOF component descriptor

A JPEG frame entry defining a component identifier, sampling factors, and quantization table selector.

PNG chunk CRC

A check value calculated over chunk type and data, excluding the chunk length.

iloc extent

A location and length description used to locate the bytes belonging to a HEIF item.

pitm primary item

The HEIF metadata entry that identifies the primary image item.

ipma association

The mapping between HEIF items and properties stored in the item property container.

iinf item information

The HEIF box holding descriptive entries that identify item types and related information.

How do JPEG segment lengths separate metadata from scan data?

A JPEG codestream starts with SOI, FF D8. Most following marker segments contain a two byte length in big endian order. That length includes the two length bytes but excludes the marker itself. A parser uses it to skip the segment payload safely rather than searching for the next apparent marker within arbitrary binary content.

JPEG objectMarkerStructural role
APP0FF E0Often carries a JFIF identifier and density information
APP1FF E1Can carry Exif TIFF data or an XMP packet
DQTFF DBDefines quantization tables selected by frame components
SOF0 or SOF2FF C0 or FF C2Defines baseline or progressive frame parameters
SOSFF DADefines scan component selection before coded scan bytes

Scan bytes require a different reading rule

Within entropy coded scan data, a literal FF byte is represented using FF 00 stuffing. Restart markers, when used, divide decoding intervals. A simple search for FF followed by any value will therefore misidentify boundaries. The decoder must account for stuffing, restart markers, and the coding process. Progressive JPEG also returns to markers for later scans rather than placing every coefficient in a single scan.

SOI, EOI, and restart markers do not have ordinary segment length fields. Applying the general length rule to them shifts every subsequent offset and creates false anomalies. A useful segment inventory records each marker offset, declared length where applicable, payload identifier, and the next expected boundary. Compare that inventory with a complete decode rather than trusting a preview generated by the operating system.

The first valid EOI, FF D9, closes that codestream. Additional bytes may be padding, a second resource, or unrelated material. Record their exact range and content. A second JPEG inside an APP1 thumbnail is not equivalent to a second JPEG appended after the main image. The compression examination uses this structural map to associate tables and scans correctly.

A picture that opens can still deserve structural review

We inspect declared boundaries, unused material, and image relationships to explain what a normal viewer displays and what it ignores.

Request Confidential Consultation Call (833) 292 3733

How do PNG chunk boundaries and CRC values work?

PNG begins with 89 50 4E 47 0D 0A 1A 0A. Each chunk then contains a four byte data length, a four byte type, that many data bytes, and a four byte CRC. Numeric lengths use network byte order. The CRC covers the type and data, not the length or its own stored value. A correct CRC indicates agreement of those bytes with a check value, not authenticated authorship.

PNG chunkExpected contentExamination question
IHDRWidth, height, bit depth, color type, and coding methodsDo the dimensions and pixel representation match the decoded output?
PLTEPalette entries where applicableIs the palette required and correctly ordered for this color type?
IDATConsecutive portions of one compressed image streamDoes the combined stream decompress to valid scanlines?
eXIfExif metadata represented as TIFF structureAre offsets valid within the metadata data area?
IENDZero data bytesWhat remains after the closing chunk, if anything?

Chunk layout differs from pixel layout

Multiple IDAT chunks do not mean multiple pictures or editing sessions. Encoders may divide the same compressed stream into different chunk sizes without changing the reconstructed pixels. The image stream includes filtering choices for scanlines before compression. Different filters and compression settings can produce different file bytes for identical samples.

Text can appear in tEXt, compressed text in zTXt, and international text in iTXt. Preserve the keyword, encoding details, and raw payload before extracting text. Color information can appear in chunks such as iCCP, sRGB, or gAMA, subject to specification rules. Different viewers may render the same sample values differently when they honor different color information. That is not automatically evidence of pixel replacement.

Unknown ancillary chunks can be legitimate extensions. Interpret chunk type properties and current format specifications rather than deleting unfamiliar material. A repaired PNG should be a separate derivative with a new digest and an operation log. Otherwise an attempt to make the file readable can erase the very defect the examination needs to explain.

How do HEIC boxes identify the image that is actually displayed?

HEIC commonly uses the ISO base media organization. An ordinary box starts with a four byte size and four byte type. Special size values alter how the boundary is interpreted, so a robust parser checks those rules before stepping to the next box. The ftyp box declares a major brand and compatible brands. Brands such as heic and mif1 describe format compatibility, not the make of a particular phone.

Follow item identities instead of physical order

The meta box organizes item information and relationships. Its children can include iinf for item descriptions, iloc for locations, pitm for the primary image, and iprp for item properties and their associations. The primary item can be a grid derived from several coded tile items. Taking the first HEVC payload encountered may produce only one tile rather than the complete displayed photograph.

Item properties can describe spatial extents, codec configuration, rotation, mirroring, or cropping. Auxiliary resources can hold depth or other supporting image information. An Exif item is metadata, not necessarily a picture. A complete report should identify item IDs, item types, references, properties, and the data extents used for the primary rendering. Keep identifiers exactly as parsed so another examiner can trace the same reconstruction.

  • Check every referenced item exists and every extent remains within its permitted data source.
  • Account for construction methods rather than assuming every offset is an absolute file position.
  • Record transformations applied by the display process separately from stored coded dimensions.
  • Retain auxiliary items when exporting a viewing copy that cannot carry them.

A conversion to JPEG may flatten the displayed primary image and discard depth resources, item relationships, or capture metadata. That conversion is a new representation, not a faithful structural duplicate. If the dispute concerns portrait processing or native phone resources, request the HEIC file and associated library records rather than analyzing the JPEG export alone.

What do broken lengths and unexplained bytes establish?

A structural anomaly establishes a discrepancy that needs explanation. An APP1 length that extends beyond the file can indicate truncation, an invalid write, or deliberate construction. An out of bounds HEIC extent can make an item unrecoverable. A PNG CRC mismatch can result from changed data or corruption of the stored checksum. None of these observations identifies the responsible person.

Compare strict parsing with actual rendering

Record whether a strict validator rejects the file, whether a tolerant decoder opens it, and what each decoder displays. If one reader ignores a malformed tail while another stops early, preserve both results. A screenshot of the successful display is not a substitute for documenting the malformed object. The goal is to explain how readers handled particular bytes.

Distinguish a nonconforming layout from a prohibited layout only after consulting the correct format version and extensions. Newer PNG features and HEIF resource relationships can surprise older software. Conversely, a familiar viewer may quietly repair a damaged stream and conceal missing rows or substituted pixels. Independent parsing and a full resolution decode make that behavior visible.

The conclusion should identify exact offsets, lengths, affected resources, and the consequence for interpretation. For example, an invalid thumbnail offset can undermine the extracted preview without invalidating the main JPEG scan. This resource specific explanation is more useful than labeling the entire image suspicious.

Map an image container without changing its contents

Work from a verified copy and maintain an offset inventory that another examiner can reproduce.

  1. Determine the container family. Read the opening bytes and candidate brand fields. Choose a parser that supports the identified encoding and its extensions.
  2. Walk declared structural boundaries. List JPEG segments, PNG chunks, or HEIC boxes with offsets and lengths. Check arithmetic against the actual file size.
  3. Resolve internal image references. Follow TIFF offsets, PNG chunk relationships, or HEIC item locations. Mark previews, auxiliary images, and primary resources separately.
  4. Decode the complete intended image. Render the full image using documented software settings. Record orientation, dimensions, bit depth, and any decoder warnings.
  5. Account for ignored material. Identify unreferenced ranges, data after terminators, and malformed objects. Extract suspicious ranges only into separately identified working artifacts.
  6. Explain reader dependent behavior. Compare results with a second implementation where needed. State which bytes cause the disagreement and whether the visible image is affected.

What matters most

  • A HEIC export appears cropped because a viewer renders a tile instead of its grid.
  • A JPEG opens despite an APP1 segment extending beyond its available payload.
  • A PNG contains text records absent from a flattened report exhibit.
  • A photo conversion discards depth and auxiliary resources needed for comparison.
  • Two viewers produce different displays from the same malformed image stream.

Common misconceptions

  • Every FF sequence in JPEG marks a segment. Scan data uses byte stuffing and can contain restart markers. Context determines interpretation.
  • Each PNG IDAT chunk is a separate image. Consecutive IDAT chunks contribute to the compressed stream of the same default image.
  • The first HEIC coded item is always the whole photograph. The primary item may be a derived grid referencing several tiles.
  • A PNG CRC authenticates its photographer. The check value detects some data changes and can be recalculated. It supplies no signer identity.

When this applies, and when it does not

This applies when

  • JPEG marker and segment inventories
  • PNG chunk validation and complete decoding
  • HEIC primary item and auxiliary resource mapping
  • Damaged or unexpectedly rendered image containers

This does not apply when

  • Inferring a person's intent from malformed bytes
  • Treating an exported JPEG as a native HEIC duplicate
  • Concluding scene truth from parser acceptance

How Elite Digital Forensics helps

We map image resources, diagnose parser disagreements, and explain whether an anomaly affects the primary picture, a preview, metadata, or unused material. The analysts doing this work are subject matter experts in image file structure who read JPEG markers, PNG chunks, and HEIC boxes directly.

About Elite Digital Forensics

Elite Digital Forensics is an independent digital forensics practice serving attorneys, paralegals, in house counsel, insurers, lenders, businesses, and individuals nationwide. Our team includes former law enforcement forensic examiners and court qualified expert witnesses in computer, cell phone, cloud, document, and multimedia forensics. Every engagement begins with a scoped plan, hash verified evidence handling, and a clear explanation of what the examination can answer.

Related Digital Forensics Resources

Practical questions about JPEG, PNG, and HEIC organization

Can JPEG file structure include several APP1 segments?

Yes. Exif and XMP can occupy separate APP1 segments, and additional arrangements are possible. Identify each payload and its boundaries rather than assuming one APP1 record.

Does PNG structure preserve the order of editing actions?

Not generally. Chunk order supports decoding and metadata placement, not a complete chronological edit log. Export software can rebuild the entire file.

Why does HEIC structure include a small preview?

A thumbnail supports quick browsing without decoding the primary resource. Its presence and role should be identified through item metadata and relationships.

Can image structure analysis distinguish corruption from editing?

It can describe the damage and compare likely mechanisms, especially with reference copies. An isolated invalid length often cannot establish whether the cause was accidental or intentional.

Should an image structure examiner repair the original?

No. Preserve the received file unchanged. Any repaired version should be a separately hashed derivative with every modification documented.

Does image structure analysis need a hex viewer?

Raw byte inspection is useful for verifying offsets and disputed boundaries, but structured parsing and actual decoding are also needed. A hex display alone does not reconstruct every format rule.

Locate each resource before interpreting its meaning

A defensible structural account names the container, follows its references, and explains what the viewer reconstructed. That map gives later metadata and compression findings a reliable technical foundation. Our court qualified experts in image forensics can explain how the internal structure supports or contradicts the claimed source of a photo.

Request Confidential Consultation Call (833) 292 3733

Primary sources and references

  1. ITU T.81 and ISO/IEC 10918 1, Digital Compression and Coding of Continuous Tone Still Images (JPEG). www.w3.org
  2. JPEG File Interchange Format (JFIF), Version 1.02. www.w3.org
  3. W3C, Portable Network Graphics (PNG) Specification, Third Edition. W3C PNG Specification, Third Edition
  4. Library of Congress, Sustainability of Digital Formats, High Efficiency Image File Format, HEIC brands. www.loc.gov
  5. Library of Congress, Sustainability of Digital Formats, High Efficiency Image File (HEIF) Format, MPEG H Part 12. www.loc.gov
  6. Library of Congress, Sustainability of Digital Formats, TIFF, Revision 6.0. www.loc.gov
  7. Scientific Working Group on Digital Evidence (SWGDE), published standards and guidance documents. www.swgde.org

This content is for educational and informational purposes only and does not constitute legal advice. Elite Digital Forensics provides independent digital forensic services and expert witness testimony; we do not provide legal representation. Every case is fact specific; outcomes depend on the evidence, jurisdiction, and counsel. Retain qualified legal counsel for advice about your matter.

#DigitalForensics #ComputerForensics #CellPhoneForensics #ExpertWitness #DigitalForensicExperts #EliteDigitalForensics #ForensicInvestigation #CriminalDefenseForensics #ImageStructure #JPEGSegments #PNGChunks #HEICItems #ContainerValidation #ImageParsing

Assistant Icon Elite Digital Forensics Assistant
πŸ‘‹ Live Chat Now!
Free Virtual Consultation 24/7
Chat Now!

By submitting this form, you consent to be contacted by email, text, or phone. Your information is kept secure and confidential. Reply Stop to opt out at anytime.Β 

IMPORTANT: Please remember to check your spam or junk folder