This commit is contained in:
Kovid Goyal 2024-05-25 10:58:29 +05:30
parent 89bcc951ce
commit 6815707587
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -784,9 +784,8 @@ def read_alt_text(pil_im_or_path, target_lang='') -> str:
im = pil_im_or_path im = pil_im_or_path
xmp = read_xmp_from_pil_image(im) xmp = read_xmp_from_pil_image(im)
if xmp: if xmp:
alt = read_alt_text_from_xmp(xmp, target_lang) if alt := read_alt_text_from_xmp(xmp, target_lang).strip():
if alt: return alt
return alt.strip()
exif = im.getexif() exif = im.getexif()
if exif: if exif:
if desc := exif.get(270): if desc := exif.get(270):