Skip to content

exif_read_data does not support PNG metadata despite PNG supporting chunks #18162

Closed
@IlyasMohetna

Description

@IlyasMohetna

Description

The exif_read_data() function in PHP currently supports reading metadata only from JPEG and TIFF images. However, the PNG format officially supports metadata through standardized chunks (e.g., tEXt, iTXt, zTXt), yet this function does not support PNG files.

Expected Behavior
Since PNG has a structured way to embed metadata, I expected exif_read_data() to parse and return data from those chunks similarly to how it does for JPEG EXIF headers.

Actual Behavior
Attempting to use exif_read_data() on a PNG file returns false and throws a warning that the file format is unsupported.

Question
Is there a reason this functionality is limited to JPEG/TIFF? Could native support for PNG metadata be considered for inclusion in PHP without relying on external libraries or userland workarounds?

Use Case
Having native support for PNG metadata would simplify workflows involving image processing or archival, where JPEG is not the preferred format due to compression loss.

Environment
PHP Version: 8.2
OS: Ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions