Skip to content

Commit 9ad6dfe

Browse files
committed
AVIF: added warning when register plugin when no aom.
1 parent 45307c1 commit 9ad6dfe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pillow_heif/as_opener.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
from typing import Any
6+
from warnings import warn
67

78
from PIL import Image, ImageFile
89

@@ -183,6 +184,11 @@ def register_avif_opener(**kwargs) -> None:
183184
:param kwargs: dictionary with values to set in :py:class:`~pillow_heif._options.PyLibHeifOptions`
184185
"""
185186

187+
if not have_decoder_for_format(HeifCompressionFormat.AV1) and not have_encoder_for_format(
188+
HeifCompressionFormat.AV1
189+
):
190+
warn("This version of `pillow-heif` was built without AVIF support.")
191+
return
186192
options().update(**kwargs)
187193
if have_decoder_for_format(HeifCompressionFormat.AV1):
188194
Image.register_open(AvifImageFile.format, AvifImageFile, _is_supported_avif)

0 commit comments

Comments
 (0)