or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/pillow-heif@1.1.x
tile.json

tessl/pypi-pillow-heif

tessl install tessl/pypi-pillow-heif@1.1.0

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

Agent Success

Agent success rate when using this tile

94%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.45x

Baseline

Agent success rate without this tile

65%

task.mdevals/scenario-6/

HEIF Image Metadata Manager

Overview

Create a Python program that processes images and embeds custom EXIF metadata when saving them in HEIF format. The program should accept an input image, update specific EXIF fields with provided values, and save the result as a HEIF file while preserving the original image quality and color profile.

Requirements

Input Processing

The program must:

  • Accept an input image file path (any common format: JPEG, PNG, etc.)
  • Accept an output HEIF file path
  • Accept EXIF metadata fields to set (camera make, camera model, and copyright string)

EXIF Metadata Operations

The program must:

  • Load or create EXIF metadata for the image
  • Set the following EXIF tags:
    • Camera manufacturer (Make)
    • Camera model (Model)
    • Copyright information
  • Preserve any existing EXIF data not being modified

HEIF Encoding

The program must:

  • Convert the input image to HEIF format
  • Embed the updated EXIF metadata in the HEIF file
  • Use high quality encoding (quality level 90 or higher)
  • Preserve the original color profile if present

Output

The program must:

  • Save the processed image with embedded EXIF metadata to the specified output path

Implementation

Create a Python module metadata_manager.py with a function:

def add_exif_to_heif(input_path, output_path, camera_make, camera_model, copyright_text):
    """
    Load an image, add EXIF metadata, and save as HEIF format.

    Args:
        input_path: Path to input image file
        output_path: Path to output HEIF file
        camera_make: Camera manufacturer name
        camera_model: Camera model name
        copyright_text: Copyright information
    """
    pass

Test Cases { .test-cases }

Create test file: test_metadata_manager.py

Test 1: Basic EXIF Writing { .test-case @test }

Input:

  • Create a simple 100x100 RGB image
  • Camera make: "Canon"
  • Camera model: "EOS 5D Mark IV"
  • Copyright: "Copyright 2024 John Doe"

Expected behavior:

  • HEIF file is created
  • File contains EXIF data with the specified values

Test 2: EXIF Preservation { .test-case @test }

Input:

  • Load a JPEG with existing EXIF orientation tag
  • Add camera make: "Nikon" and model: "D850"
  • Copyright: "Test Copyright"

Expected behavior:

  • New HEIF file contains the added EXIF fields
  • Original EXIF orientation value is preserved

Test 3: Multiple Image Processing { .test-case @test }

Input:

  • Process 3 different images with different EXIF values
  • Each with unique camera make, model, and copyright

Expected behavior:

  • All 3 HEIF files created successfully
  • Each file contains its respective EXIF metadata

Dependencies { .dependencies }

pillow-heif { .dependency }

Provides HEIF/AVIF image encoding and EXIF metadata handling.

Pillow { .dependency }

Provides image processing and EXIF data manipulation.