Writing to the AltTextAccessibility field

Started by jims, April 15, 2025, 10:43:14 AM

Previous topic - Next topic

jims

First time user!!

I am trying to write an alt-text description to the AltTextAccessibility field of a jpg image.
From the documentation, it seemed that this syntax should work from the command line:

exiftool -overwrite_original -AltTextAccessibility<train.txt train.jpg

But nothing gets written. I have setup the exiftool folder in the path.
What error am I making?

It's the first step of looking to see if I can use exiftool to do the same for
144 images!!

Jim

Phil Harvey

Hi Jim,

Close, but try this:

exiftool -overwrite_original "-AltTextAccessibility<=train.txt" train.jpg

(assuming you want to write the contents of the "train.txt" file rather than "train.txt" literally.)

And to write the same tag to a bunch of images, specify a directory name instead of the file name.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jims

MANY thanks, Phil.

I do need to do the same for all 144 files in that directory, but it's a different alt-text file for each image. I guess it will have to be a powershell script. :-)

Phil Harvey

Either that, or create a CSV file with the appropriate entry for each file and use this command:

exiftool -csv=my.csv DIR

To see the exact format required for the input CSV file, use this command on a file that contains this information:

exiftool -csv -AltTextAccessibility train.jpg

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jims

Wow, thanks very much for that. I am slowly working my way more carefully through the documentation, but had not come across that option yet. That will save a lot of time.
Wonderful! :-)
Thanks again,
Jim

StarGeek

Quote from: jims on April 15, 2025, 11:37:47 AMI do need to do the same for all 144 files in that directory, but it's a different alt-text file for each image.

If the text filename and the image filename are the same except for the extension, as shown in your example, you could do this

exiftool -overwrite_original "-AltTextAccessibility<=%d%f.txt" train.jpg

QuoteI guess it will have to be a powershell script. :-)

Your rarely should look to writing a script with exiftool, as the startup time is the biggest performance hit. See Common Mistake #3, "Over-scripting". For example, in this post, they were using a looping script and it took 10 minutes. After changing so that exiftool was only run once, it took 30 seconds.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype