<img>
is not correct unless you know that a good alt text has been stored there. A script that automatically extracts the first string it find among a list of XMP fields could just as well find an unrelated string, the string 'none', a badly written alt text, one that was written for a different context or a string that was not meant to serve as the alt text to the image. Many of the fields that are listed above are meant to store something else than an alt text. Overall it is entirely expected that this method will not extract a useful alt text from the vast majority of images. I plan to use this method anyway, as a fallback, in the hopes that the cases where a more-than-use-less string will be extracted outnumber the cases where no alt text will be specified because the script is expected to find one. Writing a meaningfiul alt text for the context in which the image is used is still the only way to make sure that there is one.
https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata#xmp-namespaces-and-identifiers
https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata#xmp-namespaces-and-identifiers-2
https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata#xmp-properties
https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata#iim-properties
Other fields may be worthwhile to implement (Credit Line, Creator's Contact Info, Copyright Notice or others depending on the application).
https://exiftool.org/TagNames/XMP.html
https://exiftool.org/TagNames/EXIF.html
https://exiftool.org/TagNames/
The above list is for image files in general. Other file type may have other/additional tags that are useful for similar purposes to the img tags alt attribute. Video file formats definitely have sevel different additional description fields.
lang-alt fields may have strings in different languages.
XMP-iptcCore:ExtDescrAccessibility
Iptc4xmpCore:ExtDescrAccessibility
ExtDescrAccessibility
XMP-iptcCore:AltTextAccessibility
Iptc4xmpCore:AltTextAccessibility
AltTextAccessibility
XMP:dc:description
dc:description
IPTC:Caption-Abstract
XMP:ImageDescription
XMP:Descrption
ImageDescription
Description
XMP:Headline
Headline
IPTC:Headline
XMP-photoshop:Headline
XMP-dc:Title
dc:title
Title
IPTC:ObjectName
Iptc4xmpExt:AOTitle
AOTitle
Some have been left out (uncommon, MS-specific). It's hard to decide where to stop this list. There will always be some tag that some image editing application, some batch script, some online converter or some weird camera writes but no major software ever reads.
Some of the above are not according to the respective standard or don't belong in most image file types. But I argue it's worth checking for them because there's not much cost to it and people don't always follow standards exactly, thus manually tagging images or creating software that tags images with fields in the wrong namespace or with the same fields across all image file types.
Looking for a string in all of those fields and inserting it as the alt text in
Comment via email