Skip to content

Commit

Permalink
AVIF: added warning when register plugin when no aom.
Browse files Browse the repository at this point in the history
  • Loading branch information
bigcat88 committed Sep 11, 2022
1 parent 45307c1 commit 9ad6dfe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pillow_heif/as_opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

from typing import Any
from warnings import warn

from PIL import Image, ImageFile

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

if not have_decoder_for_format(HeifCompressionFormat.AV1) and not have_encoder_for_format(
HeifCompressionFormat.AV1
):
warn("This version of `pillow-heif` was built without AVIF support.")
return
options().update(**kwargs)
if have_decoder_for_format(HeifCompressionFormat.AV1):
Image.register_open(AvifImageFile.format, AvifImageFile, _is_supported_avif)
Expand Down

0 comments on commit 9ad6dfe

Please sign in to comment.