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-2/

Image Data Converter

Build a utility that converts raw image data into HEIF format and extracts basic image properties.

Capabilities

Convert raw RGB data to HEIF

Your utility should accept raw RGB pixel data along with image dimensions and convert it to HEIF format.

  • A function accepts RGB mode, size (800, 600), and raw bytes data, returning a file object in HEIF format @test
  • A function accepts RGBA mode, size (400, 300), and raw bytes with alpha channel, returning a HEIF file @test

Extract image properties from created files

After creating a HEIF file from raw data, the utility should be able to extract and return the image properties.

  • Extract size property from a HEIF file created from raw RGB data, returning (width, height) tuple @test
  • Extract color mode from a HEIF file created from raw RGBA data, returning the mode string @test

Implementation

@generates

API

def create_heif_from_bytes(mode: str, size: tuple, data: bytes) -> bytes:
    """
    Create a HEIF format file from raw pixel data.

    Args:
        mode: Color mode string (e.g., "RGB", "RGBA")
        size: Image dimensions as (width, height) tuple
        data: Raw pixel data as bytes

    Returns:
        HEIF file data as bytes
    """
    pass

def get_image_properties(heif_data: bytes) -> dict:
    """
    Extract properties from HEIF data.

    Args:
        heif_data: HEIF file data as bytes

    Returns:
        Dictionary with 'size' (tuple) and 'mode' (str) keys
    """
    pass

Dependencies { .dependencies }

pillow-heif { .dependency }

Provides HEIF/AVIF image format support for encoding and decoding.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-pillow-heif

tile.json