05-14-2024, 10:47 AM | #1 |
Connoisseur
Posts: 78
Karma: 2138296
Join Date: Nov 2016
Device: ipad, Kindle Scribe, Kobo Libra 2
|
Question about alt-text in Access-Aide
In the "Update Alt for each image" page in Access-Aide, where does the plugin get the alt-text that had already been entered for images. Is it only from the html code for the image? If the image already has alt-text in its metadata, would Access-Aide be able to pick that up.
I have about 50-60 images for an ebook that I am working on and they have alt-text entries in the Alt-text (Accessibility) field. It would be great if Access-Aide could pick that up. At the moment it looks like it will be necessary to copy and paste the text into the Update-Alt page. Thanks Jim |
05-14-2024, 11:30 AM | #2 |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
AccessAide parses each img tag to obtain the current alt= attribute value and uses that to initialize the alternative text value. That attribute has long been the correct one for accessibility purposes.
So what other accessibility field are you talking about exactly. Please provide an example straight from an xhtml file. Some images contain internal metadata but that is inconsistently filled and not used. |
Advert | |
|
05-14-2024, 12:18 PM | #3 |
Guru
Posts: 782
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
|
|
05-14-2024, 12:22 PM | #4 |
Connoisseur
Posts: 78
Karma: 2138296
Join Date: Nov 2016
Device: ipad, Kindle Scribe, Kobo Libra 2
|
Thanks for the information, Kevin.
The accessibility (alt-text) field is in the internal metadata of these images, so I cannot give an example from an xhtml file. This is the first time I've seen this in the internal metadata of an image file. I saw it when I was going to enter caption text in the Description Field of the images. It might be that more people are paying attention to providing alt-text for their images and putting this into the meta-data is a good place to put it. But if access-aide does not look there for alt-text information, no worries, I can copy and paste into the Access-Aide field. I was expecting to have to write the alt-text myself, so copying and pasting is less work. Thanks again. Jim |
05-14-2024, 12:34 PM | #5 | |
Connoisseur
Posts: 78
Karma: 2138296
Join Date: Nov 2016
Device: ipad, Kindle Scribe, Kobo Libra 2
|
Quote:
|
|
Advert | |
|
05-14-2024, 03:31 PM | #6 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
It might be possible to extract this information with the Pillow Python library if it's not an HEIF or AVIF image.
Can you attach a sample image that has this information? |
05-14-2024, 03:46 PM | #7 | |
Bibliophagist
Posts: 40,487
Karma: 156983616
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
ExifData.com recommended by CogDogBlog seems to be down but trying jimpl.com, viewing all metadata, it showed the alt text as: Code:
AltTextAccessibility This is the Alt Text description to support accessibility in 2022.1 |
|
05-14-2024, 03:58 PM | #8 |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Interesting ... if Pillow can extract the AltTextAccessibility field from the image Metadata, I could certainly modify AccessAide to read it if it exists and use it to initialize the alt attribute value.
So @Doitsu, any luck using a recent Pillow to extract it? |
05-14-2024, 04:56 PM | #9 | |
Connoisseur
Posts: 78
Karma: 2138296
Join Date: Nov 2016
Device: ipad, Kindle Scribe, Kobo Libra 2
|
Quote:
|
|
05-14-2024, 05:32 PM | #10 |
Guru
Posts: 782
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
|
Here code:
Code:
import exiftool with exiftool.ExifTool() as et: alt_text_from_exif = et.execute("-XMP:Alt Text Accessibility", "test.jpg") alt_text_from_exif = alt_text_from_exif.replace('[XMP] Alt Text Accessibility : ', '') print(alt_text_from_exif) result: A monk, holding a stick in his left hand and a bowl in his right hand, stands in front of a crowd of peopple. |
05-14-2024, 05:49 PM | #11 |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Is the exiftool part of Pillow? If not, I would prefer to use something guaranteed to work in our internal python internal to Sigil without having to add anything. Unless exiftool is standalone and in pure python?
|
05-14-2024, 05:50 PM | #12 |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Any other metadata fields that might indicate the language used for this alt text? It it guaranteed to be utf-8 encoded?
|
05-14-2024, 05:51 PM | #13 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Apparently, AltTextAccessibility is an Exiv2 metadata entry. The closest EXIF equivalent is ImageDescription, which Pillow supports. Theoretically, Pillow is also supposed to support XML metadata via getxmp(), but I couldn't get the sample code to work.
The sample image referred to by BeckyEbook and DNSB contains the following metadata as plain text: Code:
<Iptc4xmpCore:AltTextAccessibility> <rdf:Alt> <rdf:li xml:lang='x-default'>This is the Alt Text description to support accessibility in 2022.1</rdf:li> <rdf:li xml:lang='en'>This is the Alt Text description to support accessibility in 2022.1</rdf:li> </rdf:Alt> </Iptc4xmpCore:AltTextAccessibility> Some StackOverflow users recommended searching for XMP metdata as text and parsing it with bs4. |
05-14-2024, 06:08 PM | #14 | |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Quote:
|
|
05-15-2024, 10:46 AM | #15 |
Connoisseur
Posts: 78
Karma: 2138296
Join Date: Nov 2016
Device: ipad, Kindle Scribe, Kobo Libra 2
|
Thanks for all these helpful posts. They prompted me to look at metadata more deeply.
I first saw the alt-text entries for this set of 53 images while looking at the metadata in Bridge. But when I looked at the images in Photoshop, the entries that were in alt-text (Accessibility) in Bridge were in Extended Description in Photoshop. CORRECTION. Photoshop DOES display the same alt-text metadata as Bridge and Photomechanic. There was an entry error in the two files I happened to be looking at in Photoshop. The alt-text had been entered into the wrong field. But in PhotoMechanic, a widely used program for managing image metadata, the alt-text entry agrees with the Bridge format. PhotoMechanic gives me a lot of control over the metadata of the images. It's over 10 years since I used PM, so I'm very rusty. But if more metadata variations are needed, things might come back fairly quickly. Last edited by oston; 05-16-2024 at 09:55 AM. |
Tags |
access-aide, alt text |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Plugin] Access-Aide - help improve epub accessibility | KevinH | Plugins | 147 | 10-15-2024 11:25 AM |
Bug: splitting pages after using Access Aide | oston | Sigil | 4 | 04-08-2024 08:59 AM |
[Editor Plugins] Access Aide | wolf123 | Plugins | 5 | 07-08-2023 02:10 PM |
access-aide failure | oston | Sigil | 5 | 06-27-2023 04:42 PM |
Alt Text in epub | Lancelot | ePub | 3 | 09-11-2013 04:55 AM |