CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pillow-heif

Python interface for libheif library providing HEIF/AVIF image processing with both standalone and Pillow plugin capabilities

Overall
score

94%

Overview
Eval results
Files

task.mdevals/scenario-7/

XMP Metadata Extractor

Build a tool that extracts and displays XMP metadata from HEIF/AVIF image files.

Requirements

Create a Python module that provides functionality to read and extract XMP metadata from HEIF and AVIF image files. The tool should handle both files with XMP data and files without XMP data gracefully.

Capabilities

Extract XMP metadata from HEIF images

  • Opening a HEIF file that contains XMP metadata returns the XMP data as a UTF-8 encoded string @test
  • Opening a HEIF file without XMP metadata returns None or an empty result @test

Extract XMP metadata from AVIF images

  • Opening an AVIF file with XMP metadata returns the XMP data as a UTF-8 encoded string @test

Handle invalid input gracefully

  • Attempting to extract XMP from a non-existent file raises an appropriate error @test

Implementation

@generates

API

def extract_xmp(file_path: str) -> str | None:
    """
    Extract XMP metadata from a HEIF or AVIF image file.

    Args:
        file_path: Path to the HEIF/AVIF image file

    Returns:
        XMP metadata as a UTF-8 string if present, None otherwise

    Raises:
        FileNotFoundError: If the file does not exist
        ValueError: If the file is not a valid HEIF/AVIF file
    """
    pass

Dependencies { .dependencies }

pillow-heif { .dependency }

Provides HEIF/AVIF image processing with metadata support.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-pillow-heif

tile.json