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

Image Format Converter

Create a command-line utility that converts images from common formats (PNG, JPEG) to HEIF and AVIF formats with customizable quality settings.

Requirements

Build a Python module that provides image format conversion functionality with the following features:

Format Conversion

The module should provide a function that converts an input image file to either HEIF or AVIF format. The function should:

  • Accept an input file path (supporting PNG and JPEG formats)
  • Accept an output file path where the converted image will be saved
  • Accept a target format parameter (either "HEIF" or "AVIF")
  • Accept an optional quality parameter (integer from 0-100, default 85)

Quality Control

The converter should support quality control:

  • Allow users to specify compression quality from 0 (lowest) to 100 (highest)
  • Support lossless compression when quality is set to -1
  • Use appropriate default quality (85) when not specified

Alpha Channel Support

The converter should handle images with transparency:

  • Preserve alpha channel information when present in the source image
  • Ensure the output format maintains the alpha channel

Test Cases

  • Converting a PNG file to HEIF format with default quality produces a valid HEIF file @test
  • Converting a JPEG file to AVIF format with quality 90 produces a valid AVIF file @test
  • Converting a PNG with transparency to HEIF preserves the alpha channel @test
  • Converting with lossless quality (-1) produces a lossless output @test

Implementation

@generates

API

def convert_image(input_path: str, output_path: str, format: str, quality: int = 85) -> None:
    """
    Convert an image to HEIF or AVIF format.

    Args:
        input_path: Path to the input image file (PNG or JPEG)
        output_path: Path where the converted image will be saved
        format: Target format, either "HEIF" or "AVIF"
        quality: Compression quality (0-100), or -1 for lossless (default: 85)

    Raises:
        ValueError: If format is not "HEIF" or "AVIF"
        FileNotFoundError: If input file does not exist
    """
    pass

Dependencies { .dependencies }

pillow-heif { .dependency }

Provides HEIF and AVIF image encoding and decoding capabilities.

@satisfied-by

Pillow { .dependency }

Provides core image processing functionality for reading input images.

@satisfied-by