Image descriptions (alt text) in Gwenview

In Social Media, as on the internet in general, it has become widely normal to add descriptions (alt text) to images to aid visually impaired users.

But what, if we want to avoid typing them again and again, in case we want to reuse an image?

Luckily, our favourite image viewers, like GwenView or gThumb, can help with that: You can easily store image descriptions with your images (see picture), from where they can be copied and pasted into the description field when creating a social media post.

When downloading a file, which already has a description, from the internet, there is a useful add-on to major browsers, like FireFox and the Chrome family: “copy alt text”.

There is a small caveat: E.g. GwenView stores the description in the extended file attributes.

Unfortunately, the default behaviour of the cp command is not to copy these attributes. In order to do so, you need to add the option --preserve=all to the command.

What I did, was to add the line

alias cpa='cp --preserve=all'

to my .bashrc file.

I hope, you find this information useful.

5 Likes

Hello Mina,
Nice to hear from you again.
I do find that interesting because @Rosika and I have been
playing with adding images to markdown documents.
Markdown has a syntax like this

![Alt Text](path-to-image "Title")

The Title bit displays under the image, and the Alt Text bit
seems to be displayed if the image can not be displayed.

I just wonder whether this Alt Text in markdown is the same as the image descriptions you refer to.
Yours are extended file attributes so they move around with the image file.
If I copied a file with extended attributes into
markdown, I wonder what would happen?
I will try it.
Regards
Neville

2 Likes

Hello Neville!

Great to see, you’re still around.

Yes, the image description, I’m referring to is the same thing as the Alt Text in Markdown, or, translated into HTML:

<img src="..." alt="...">

However, when uploading an image onto a website or into an app, most meta information is automatically stripped off, in order to protect your privacy, so no way to get it inserted automatically.

3 Likes

That seems to work against what I have been reading about accessibility.
Screen readers for visually impaired people are supposed to turn the Alt Text associated with an image into a voice.

How can they do that if the metadata gets stripped off when you try to load an image into a webpage?

Is that what you mean by accessibility not working properly?

You’re right. The screen readers turn the description (alt text) into speech, but the stripping away of meta information makes it necessary to insert the text manually, either by typing or by copy and paste.

Here in this forum, which uses markdown, it looks like this:

![Image description](filename "optional image title")

On social media (say Mastodon, or X/Twitter) with an upload function, you click on some button, usually called “add description” and get a text field to enter the alt text.

3 Likes

I am getting it now. I can add a description to any image with gwenview or gthumb, and it stores it using xattr.
Do you know how or where the a linux filesystem keeps the extended file attributes. This is different from camera information (Exif)… that is kept in the file.

2 Likes

The extended attributes are features of modern file systems like ownership and read/write/execute privileges. You find them e.g. in ext4 and NTFS, but not in old ones, like FAT.

The EXIF information, where e.g. gThumb stores the “alt text” information, is part of many (but not all) image formats.

Both approaches have advantages and disadvantages.

1 Like

Thank you Mina.
I must apologise for being a pain with questions.
You have opened my eyes to this vision impaired area, and this is part of the learning curve.

I have tried with gthumb. I can store a comment, and it goes in the Exif area, which, as you say , is in the file header. I have not found anything called ‘alt text’ in gthumb yet. Keep looking.

I have not found any way of creating an extended attribute. The functions getfattr() and setfattr() mentioned on the xattr() man page
do not seem to exist in my Void Linux.
OK I need to install something

[nevj@trinity ~]$ xbps-query -Rs attr
[*] attr-2.5.1_1                   Extended attribute support library for AC...
[-] attr-devel-2.5.1_1             Extended attribute support library for AC...
[-] attr-progs-2.5.1_1             Extended attribute support library for AC..

I need attr-progs

# xbps-install attr-progs

OK , now I have a man page for getfattr() and setfattr()

[nevj@trinity ~]$ getfattr /run/media/nevj/LinuxHome1/nevj/juana.jpeg
[nevj@trinity ~]$ 

Nothing there… you told me it would be censored if I downloaded the image.
So lets try and add an attribute

[nevj@trinity ~]$ setfattr -n alt -v "Juana Ines de la Cruz" /run/media/nevj/LinuxHome1/nevj/juana.jpeg
setfattr: /run/media/nevj/LinuxHome1/nevj/juana.jpeg: Operation not supported
[nevj@trinity ~]$ 

Oh well, more things to fathom. I will get there

3 Likes

This works

nevj@trinity:~
$ attr -s alt -V "Juana Ines de la Cruz" juana.jpeg
Attribute "alt" set to a 21 byte value for juana.jpeg:
Juana Ines de la Cruz
nevj@trinity:~

I still can not see anything in gthumb?

but it is there

nevj@trinity:~
$ getfattr juana.jpeg
# file: juana.jpeg
user.alt

nevj@trinity:~

???

1 Like

Your questions are not a pain at all. Just a year ago, I had no idea myself. It was the contact to blind and partially sighted people on social media which made me aware of accessibility issues.

This is, how we learn: We Listen to other people and then start our own journey.

Stop looking!

“Alt text” is just colloquial speech for “image description”. The origin of the term is the alt tag in HTML.

Until now, I hadn’t tried to set extended attributes directly, I always did so via GwenView.

So, I tried and ran into the same issue as you (but found the solution). Have a look:

Rechner:~$ getfattr -d Pictures/Screenshot_20230616_143100.png 

# file: Pictures/Screenshot_20230616_143100.png
user.xdg.comment="Screenshot of the directory view 
of the GwenViewimage viewer.\012\012
On the right thumbnails of pictures of which one is 
highlighted, on the right a pane with three tabs:
\012\012Folders, info. operations \012\012
The info tab is the one opened and there is a 
text field for image description."

Rechner:~$ setfattr -n "test for Neville" 
-v "This might work or not" 
Pictures/Screenshot_20230616_143100.png

setfattr: Pictures/Screenshot_20230616_143100.png: 
Operation not supported

Rechner:~$ setfattr -n user."test for Neville" -v "This might work or not" Pictures/Screenshot_20230616_143100.png

Rechner:~$ getfattr -d Pictures/Screenshot_20230616_143100.png 
# file: Pictures/Screenshot_20230616_143100.png
user.test for Neville="This might work or not"
user.xdg.comment="Screenshot ...  description."

See!? You have to prefix the attributes’ name with user.!

The author of the manual page could have mentioned that, I believe.

2 Likes

I love that understatement.
Thank you, it would have taken me ages to find that.

I think gthumb may be lacking something.
I have a Qt system with gwenview… I will try there.

and
OK I thought the extended attribute had to be called ‘alt’… another misconception

I hope someone benefits from this , apart from me.

3 Likes

One person is enough, but the more, the merrier.

3 Likes

Hi Mina, :wave:

I just tried the following with a test image file:

setfattr -n user.hexe -v "Heideschnucken" ./kgw_20Urlaub2023.jpeg

and reviewed the result:

getfattr -d ./kgw_20Urlaub2023.jpeg
# file: kgw_20Urlaub2023.jpeg
user.hexe="Heideschnucken"

So the adding of the image description has worked, it seems.

However when looking at the “modified” picture in shotwell the additional tag isn´t displayed. It´s empty,

So I thought shotwell doesn´t support tags, but it does.
It has a “tags” option in the upper shelf and from there: “Add Tags” and “Modifiy Tags”.

Perhaps shotwell´s tags feature differs from the setfattr command in some way :question:

Cheers from Rosika :slightly_smiling_face:

1 Like

What we don’t know (yet) is, where Shotwell stores its tags.

It might be in the attributes (but surely, not in one called “witch”), it might be in the EXIF data, or it might be even in an internal database (my guess).

Let’s go hunting!

But not now, I have to cook.

2 Likes

Thanks for the hint, Mina. :heart:

No hurry at all.
I won´t be back before Thursday either.

Happy cooking.

Cheers from Rosika :slightly_smiling_face:

 looking at the “modified” picture in shotwell the additional tag isn´t displayed. It´s empty,

Hi @Rosika ,
@Mina did not say that Gwenviw or gthumb could see extended attributes. I guess the same applies to Shotwell
Here is what Mina said

Luckily, our favourite image viewers, like GwenView or gThumb, can help with that: You can easily store image descriptions with your images (see picture), from where they can be copied and pasted into the description field when creating a social media post.

So the idea is you can store an image description in a tag or a comment in the image viewer, then copy/paste it into the alt text field when uploading an image.

It took me a long time to grasp this… I too expected the viewer to see the extended attribute. It may be able to, but we have not discovered how yet.

The extended attribute is really quite useless, because it will not automatically upload when you upload the image.
Mina did also say that there is a browser extension which will download alt text, but it stores it as an extended attribute, which is not very useful, at least we can not see how to use it yet.

I think this topic is a great example of how difficult it can be to get an idea over to other people who may not understand all of its aspects. None of us understood extended attributes, and it seems to be unusable anyway. We should thank @Mina for her patience.

Regards
Neville

2 Likes

I think, I might do a small introduction into this subject, covering the different aspects, we have discovered so far, as I see there are still a few confusions.

It doesn’t really fit into ItsFoss, as it transcends operating systems and applications, so I’m gonna put it somewhere and link it into this thread, then the bosses (Abhishek, Ankush, ???) can decide if they want to take it.

3 Likes

Good idea. It needs drawing together.
Rosika and I did something like that on another topic… we did it as a series of markdown documents… which we loaded into a topic…
See here

That is one way to do what you have in mind

1 Like

Hey!

Great job, you two! (I will actually read it, because this is a topic, I’m interested in)

I haven’t yet decided, but this is definitely an option.

2 Likes

@Mina
This makes clear that there is a big difference between gwenview and gthumb
https://bbs.archlinux.org/viewtopic.php?id=238755
Dont know where shotwell stands.