News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Remove _ and - from tags when writing based on file name

Started by avalut, January 02, 2019, 05:54:22 PM

Previous topic - Next topic

avalut

This is what it is doing
======== C:/Users/Andrew/Desktop/testimage/Lot_439_1-Heathrow-T1-Aviation-Glass-
Desk.jpg
ExifTool Version Number         : 11.23
File Name                       : Lot_439_1-Heathrow-T1-Aviation-Glass-Desk.jpg
Directory                       : C:/Users/Andrew/Desktop/testimage
File Size                       : 234 kB
File Modification Date/Time     : 2019:01:03 03:22:26-08:00
File Access Date/Time           : 2019:01:03 03:22:26-08:00
File Creation Date/Time         : 2019:01:02 12:22:33-08:00
File Permissions                : rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Big-endian (Motorola, MM)
X Resolution                    : 96
Y Resolution                    : 96
Resolution Unit                 : inches
Artist                          : Phil Harvey
Y Cb Cr Positioning             : Centered
Copyright                       : 2011 Phil Harvey
XMP Toolkit                     : Image::ExifTool 11.23
Creator                         : Creator
Subject                         : Lot_439_1-Heathrow-T1-Aviation-Glass-Desk
Title                           : Lot 439 1 Heathrow T1 Aviation Glass Desk
Comment                         : CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), de
fault quality.
Image Width                     : 1000
Image Height                    : 750
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 1000x750
Megapixels                      : 0.750

Stephen Marsh

Rather than using tag shortcuts, perhaps try the full form, such as:

-IFD0:Artist="Auctioneersvault Ltd"

Rather than:

-artist="Auctioneersvault Ltd"

Again, not an answer, just clutching at straws...

Stephen Marsh

Please try:

exiftool -a -G1 -s FILE

Rather than:

exiftool FILE

To receive the unambiguous full tag name/group etc.

avalut

ahahahahhahahhahahahha

Bloody Mac was producing a funny " when pasted in to my windows VPS.

Just got it to accept the artist fine so will try again with the others.
about 5 hours of going mad..

Don't copy and paste from a Mac to a windows machine.

avalut

Ok so now have it working with these 3 commands

perl c:\windows\exiftool.pl -artist="Silverstone Auction" -copyright="2019 Silverstone Auction" C:\Users\Andrew\Desktop\testimage

perl c:\windows\exiftool.pl -P -r "-title<${filename;s/\.[^\.]+$//;s/[-|_]/ /g}" -r -sep " " -ext jpg C:\Users\Andrew\Desktop\testimage

perl c:\windows\exiftool.pl -subject="Silverstone Auction AUTOSPORT INTERNATIONAL SHOW SALE 12th January 2019" C:\Users\Andrew\Desktop\testimage

The subject tag writes to the Tags section and subject is still blank.
Cannot write to comments tag - says it cannot be written to.

So how would I combine the 3 above or is it best to do one at a time?

Is there a command to create an Alt Tag for SEO that would be the Title tag?

Thanks
Andrew

Stephen Marsh

#20
Again

exiftool -a -G1 -s FILE

or

exiftool -a -G1 -s -r DIR

is your friend!

Ensure the test file has the metadata that you wish to write.

"Subject" is actually -XMP-dc:Subject which is the modern replacement of the legacy "Keyword" tag  -IPTC:Keyword.

I believe you are looking for:

-IFD0:XPSubject if you are expecting the MS Windows "Subject" field viewed under "properties"...


This is why it is helpful to use full tag names rather than shortcuts!

avalut

The alt Tag is not in the current file so has to be added - presume this is the issue.

Stephen Marsh

I have not tested, however if all of the following tags were correct, then it should just be simple matter of stringing the arguments together:

perl c:\windows\exiftool.pl -ext jpg -P -artist="Silverstone Auction" -copyright="2019 Silverstone Auction" "-title<${filename;s/\.[^\.]+$//;s/[-|_]/ /g}" -sep " " -subject="Silverstone Auction AUTOSPORT INTERNATIONAL SHOW SALE 12th January 2019" -r "C:\Users\Andrew\Desktop\testimage"

If run from a batch file in Windows, then you could put the arguments on separate lines which would help make it easier to read!

However, again I would suggest that you use the full tag names rather than shortcut tags so that the metadata write is to the correct field, not a similar named but different field.

avalut


avalut

Stephen,

I have finally managed to get 90% of the fields with data.
Where do I find the "full tag names"

I want to populate the comments tag in windows preview.

Then I think I am as good as its going to be.

avalut

Ok found where they are https://exiftool.org/TagNames/EXIF.html
that so all my actions are below and it doesn't like me combining them for some reason so will just action one at a time and if called from Ubot it should just move down them.


perl c:\windows\exiftool.pl -P -r "-title<${filename;s/\.[^\.]+$ //;s/[-|_]/ /g}" -r -sep " " -ext jpg C:\Users\Andrew\Desktop\testimage
perl c:\windows\exiftool.pl -artist="Silverstone Auctions" -copyright="2019 Silverstone Auctions" C:\Users\Andrew\Desktop\testimage
perl c:\windows\exiftool.pl -subject="Silverstone Auctions AUTOSPORT INTERNATIONAL SHOW SALE 12th January 2019" C:\Users\Andrew\Desktop\testimage


perl c:\windows\exiftool.pl -creator="Silverstone Auctions" C:\Users\Andrew\Desktop\testimage

perl c:\windows\exiftool.pl -P -r "-description<${filename;s/\.[^\.]+$ //;s/[-|_]/ /g}" -r -sep " " -ext jpg C:\Users\Andrew\Desktop\testimage

perl c:\windows\exiftool.pl -P -r "-IFD0:XPSubject<${filename;s/\.[^\.]+$ //;s/[-|_]/ /g}" -r -sep " " -ext jpg C:\Users\Andrew\Desktop\testimage

perl c:\windows\exiftool.pl -P -r "-IFD0:XPComment<${filename;s/\.[^\.]+$ //;s/[-|_]/ /g}" -r -sep " " -ext jpg C:\Users\Andrew\Desktop\testimage

Still don't have the alt Tag element but think that should give the search engines enough info.

Many thanks again.
Andrew

avalut

Stephen,

This command works better from reading the description of the lot
perl c:\windows\exiftool.pl -P -r "-title<${filename;s/\.[^\.]+$ //;s/[-]/ /g}" -r -sep " " -ext jpg C:\Users\Andrew\Desktop\testimage

So I have dropped the _
so we get say Lot_101_3 a big blue badge

The reason there are a number of images per lot so need to make that obvious.

Is there a way to remove only the first _ and substitute with a space rather than both it would then read
Lot 101_3 a big blue badge

Which would be exactly what I was after.

Andrew

Phil Harvey

Hi Andrew,

Try this to change the first underline to a space: "-title<${filename;s/\.[^\.]+$ //;s/[-]/ /g;s/_/ /}"

You should be able to combine all your commands into 2 commands.  The complication is that the -sep " " will write each word separately when writing a list-type tag, so you need one command with -sep " " and one without so that the words don't get written as separate items when writing tags like XMP:Subject.

- 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 ($).

avalut

Hi Phil,

That has worked perfect   - thank you.
I will look at trying to combine, and see how I get on.

I was looking at this post from a while back on the Alt tag is this method described at the end still valid
https://exiftool.org/forum/index.php?topic=6433.0

Finally getting my head around the tool, after spending today and last night on it.

I do like pushing things so will after I have this sorted move on to geo-location tagging and see how much of a mess I get in.

Best regards Andrew


StarGeek

Quote from: avalut on January 03, 2019, 10:47:15 AM
I was looking at this post from a while back on the Alt tag is this method described at the end still valid
https://exiftool.org/forum/index.php?topic=6433.0

It's important to note that answer has to do with what data the Zenfolio website would read.  If you're not working on Zenfolio, then it probably doesn't apply.

As to whether it still works or not would require someone with access to Zenfolio to test.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).