tessl install tessl/pypi-pillow-heif@1.1.0Python 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%
Build a Python tool that analyzes HEIF/HEIC images to extract and report information about embedded thumbnails.
Create a script that:
photo.heic)The script should:
Thumbnails found: <count> followed by Box sizes: [<size1>, <size2>, ...]No thumbnails foundthumbnail_<box_size>.pngpython thumbnail_analyzer.py photo.heicExpected output:
Thumbnails found: 2
Box sizes: [128, 256]
Saved: thumbnail_128.png
Saved: thumbnail_256.pngInput file: test_image.heic (contains 2 thumbnails with box sizes 128 and 256)
Expected output:
Thumbnails found: 2
Box sizes: [128, 256]
Saved: thumbnail_128.png
Saved: thumbnail_256.pngFile: thumbnail_analyzer.test.py
def test_thumbnail_extraction():
# Create a test HEIF image with thumbnails
import pillow_heif
from PIL import Image
# Create test image with thumbnails
img = Image.new('RGB', (1000, 800), color='blue')
heif = pillow_heif.from_pillow(img)
heif.save('test_image.heic', thumbnails=[128, 256])
# Run analyzer
import thumbnail_analyzer
result = thumbnail_analyzer.analyze('test_image.heic')
assert result['count'] == 2
assert 128 in result['box_sizes']
assert 256 in result['box_sizes']Input file: no_thumb.heic (HEIF image with no thumbnails)
Expected output:
No thumbnails foundFile: thumbnail_analyzer.test.py
def test_no_thumbnails():
import pillow_heif
from PIL import Image
# Create test image without thumbnails
img = Image.new('RGB', (400, 300), color='red')
heif = pillow_heif.from_pillow(img)
heif.save('no_thumb.heic', thumbnails=[])
# Run analyzer
import thumbnail_analyzer
result = thumbnail_analyzer.analyze('no_thumb.heic')
assert result['count'] == 0Provides HEIF/AVIF image format support for reading embedded thumbnails.
Provides image processing capabilities for saving thumbnails as PNG files.