ExifTool Forum

ExifTool => Newbies => Topic started by: brunos on March 07, 2020, 08:44:42 AM

Title: Need to rename artist...
Post by: brunos on March 07, 2020, 08:44:42 AM
Hi,

I'm doing something wrong, but I can't get what. Have thousands of photos with -artist value of (bs), set by my Canon 7D. I need to replace (bs) with bsprf. My attempts are with the exiftool-11.91 on Windows 10.

C:\Users\Bruno\Desktop\tmpfolder>exiftool -if "$artist eq ""(bs)""" -artist=bsprf -overwrite_original .
Error: Error reading StripOffsets data in IFD1 - ./026-IMG_7225.jpg
Error: Error reading StripOffsets data in IFD1 - ./046-IMG_7250.jpg
    1 directories scanned
    0 image files updated
    2 files weren't updated due to errors

Strangely enough, this one works with no errors.
C:\Users\Bruno\Desktop\tmpfolder>exiftool -if "$artist eq ""(bs)""" -creator=bsprf -overwrite_original .
    1 directories scanned
    2 image files updated

I've tried to use -exif:artist="bsprf", and  but the error persists.

Another thing: firstly, I've tested C:\Users\Bruno\Desktop\tmpfolder>exiftool -if "$creator eq ""(bs)""" -creator=bsprf -overwrite_original . and it worked, but Windows properties and Picasa properties still show (bs) - probably reading from artist and not from creator?

Thanks in advance!
Bruno

I've attached the -v5 log, hope this can help to understand what's wrong (but probably is some trivial oversight of mine...)
Title: Re: Need to rename artist...
Post by: StarGeek on March 07, 2020, 11:27:14 AM
While it is possible to try and follow Windows weird rules on double quotes inside of double quotes, it's best to just use single quotes to enclose strings inside double quoted arguments.  I've puts some spaces between the single and double quotes to make it easier to read.  The spaces themselves won't affect the command in this case.

exiftool -if "$artist eq '(bs)'  " -artist=bsprf -overwrite_original .

QuoteI've tried to use -exif:artist="bsprf", and  but the error persists.

This sets the value of EXIF:Artist to "bsprf", it doesn't compare.

QuoteAnother thing: firstly, I've tested C:\Users\Bruno\Desktop\tmpfolder>exiftool -if "$creator eq ""(bs)""" -creator=bsprf -overwrite_original . and it worked, but Windows properties and Picasa properties still show (bs) - probably reading from artist and not from creator?

Windows (and many other programs) will read metadata from multiple different tags.  Which value it uses seems to depend upon the actual location in the file in some way, as in my testing, it can vary between files.  You can see what tags Windows reads for it's Properties->Details values in this post (https://exiftool.org/forum/index.php?topic=6591.msg32875#msg32875).

In the case of the Windows properly "Author", it will read from these tags: EXIF:Artist, IPTC:By-line, XMP:Creator, and EXIF:XPAuthor.  I haven't check Picasa for this value but if it follows the same pattern as it does for other tags, then it's probably reading/setting IPTC:By-line and XMP:CreatorEXIF:XPAuthor is pretty much a Windows only tag, very few other programs will read/write it.
Title: Re: Need to rename artist...
Post by: brunos on March 07, 2020, 11:42:28 AM
Thanks StarGeek, I've tried your syntax (copy and paste from the reply to cmd window), but the error is just the same as before...

C:\Users\Bruno\Desktop\tmpfolder>exiftool -if "$artist eq '(bs)'  " -artist=bsprf -overwrite_original .
Error: Error reading StripOffsets data in IFD1 - ./052-IMG_7256.jpg
Error: Error reading StripOffsets data in IFD1 - ./053-IMG_7257.jpg
    1 directories scanned
    0 image files updated
    2 files weren't updated due to errors

C:\Users\Bruno\Desktop\tmpfolder>

BTW, I've tried it on more JPGs, just to exclude the corruption. Anyway, the reading works well, the writing fails

C:\Users\Bruno\Desktop\tmpfolder>exiftool -artist .
======== ./052-IMG_7256.jpg
Artist                          : (bs)
======== ./053-IMG_7257.jpg
Artist                          : (bs)
======== ./053-IMG_7257small.jpg
Artist                          : (bs)

I attached a scaled down original foto if you want to try it.

Kindest regards
Bruno
Title: Re: Need to rename artist...
Post by: StarGeek on March 07, 2020, 12:10:05 PM
Oops, my mistake.  I was so focused on the quotes thing that I didn't actually read what the errors were.

The EXIF block for that image has been written incorrectly.  StripOffsets is not supposed to exist in jpg images.  See FAQ #20 (https://exiftool.org/faq.html#Q20) for the fix.  Do NOT run that fix on any type of RAW image, just jpgs.
Title: Re: Need to rename artist...
Post by: brunos on March 07, 2020, 12:29:01 PM
I've tried the command exiftool -all= -tagsfromfile @ -all:all -unsafe -icc_profile bad.jpg, it gave errors, but it looks like it fixes the problem anyway. Here's the test repeated 4 times in the sequence as shown. Remains to understand what happened with those photos... Thanks a lot, StarGeek...

C:\Users\Bruno\Desktop\tmpfolder>exiftool -if "$artist eq '(bs)'  " -artist=bsprf -overwrite_original .
Error: Error reading StripOffsets data in IFD1 - ./051-IMG_7255.jpg
    1 directories scanned
    0 image files updated
    1 files weren't updated due to errors

C:\Users\Bruno\Desktop\tmpfolder>exiftool -all= -tagsfromfile @ -all:all -unsafe -icc_profile -ext jpg .
Warning: Not enough values specified (4 required) for ExifIFD:ComponentsConfiguration - ./051-IMG_7255.jpg
    1 directories scanned
    1 image files updated

C:\Users\Bruno\Desktop\tmpfolder>exiftool -if "$artist eq '(bs)'  " -artist=bsprf -overwrite_original .
    1 directories scanned
    1 image files updated

C:\Users\Bruno\Desktop\tmpfolder> 
Title: Re: Need to rename artist...
Post by: Phil Harvey on March 08, 2020, 09:17:36 AM
Your second command gives a warning, not an error.  Warnings don't stop the file from being written.  It does, however likely indicate that ComponentsConfiguration wasn't copied.

- Phil
Title: Re: Need to rename artist...
Post by: j99mac on May 28, 2020, 08:23:13 AM
how would you use this exiftool -if "$artist eq '' " to compair and then change the artist if blank or filled in?
Title: Re: Need to rename artist...
Post by: Phil Harvey on May 28, 2020, 09:45:41 AM
1. Use a -if condition to select the files you want to process.

2. Add a tag assignment to set the tags you want to write for these files.

For example:

exiftool -if '$artist eq ""' -artist="me" DIR

- Phil
Title: Re: Need to rename artist...
Post by: j99mac on May 28, 2020, 02:29:30 PM
when I run the command
exiftool -if '$artist eq ""' -artist="me" $directory

Error: File not found
Title: Re: Need to rename artist...
Post by: StarGeek on May 28, 2020, 02:52:03 PM
The error is self explanatory.  The file you specified doesn't exist.
Title: Re: Need to rename artist...
Post by: j99mac on May 28, 2020, 03:08:38 PM
I have a tiff file that dose not have an artist field that I am trying to work on. Is there away to work on a file with no artist field
Title: Re: Need to rename artist...
Post by: StarGeek on May 28, 2020, 03:28:38 PM
There seems to be some problem communicating, so let's take it back to the basics.

What is the output of this command.  Run it on the command line, not as part of any script.  Replace /path/to/file.tif with the path to the tiff file.
exiftool -Artist /path/to/file.tif
Title: Re: Need to rename artist...
Post by: j99mac on May 28, 2020, 08:52:13 PM
when I run exiftool -Artist and path to my to tiff. I get the error  1 files failed condition. The file I am file has nothing in the artist feild
Title: Re: Need to rename artist...
Post by: j99mac on May 30, 2020, 07:59:53 AM
the command
exiftool -if '$artist eq ""' -artist="me" DIR
Do I need to first write a blank exif field artist

or how can i make sure the commd work if there is no feild in a image file?
Title: Re: Need to rename artist...
Post by: StarGeek on May 30, 2020, 11:07:09 AM
Ok, I think I see the problem.

It sounds like the Artist tag doesn't exist in your file, but your initial question seemed to indicate that the tag existed, but had no content, i.e. it was a 0 length value.

Try
exiftool -if 'not $artist' -artist="me" DIR
Title: Re: Need to rename artist...
Post by: j99mac on November 03, 2021, 09:53:45 AM
exiftool -if 'not $artist' -artist="me" DIR

And get the fallowing results

   1 directories scanned
    0 image files read

there away to get it to add me if artist is blank? or get it to show me the result if the tad has something in it.
Title: Re: Need to rename artist...
Post by: StarGeek on November 03, 2021, 10:39:16 AM
Your command is correct, but as the output shows, there aren't any files in the directory you gave exiftool.  If there were files to process in that directory, you would have at least gotten "x files failed".

Did you forget to add the -r (-recurse) option (https://exiftool.org/exiftool_pod.html#r-.--recurse) to recurse into subdirectories?
Title: Re: Need to rename artist...
Post by: j99mac on November 04, 2021, 10:00:05 AM
I am getting the error
Error: Not a valid TIFF (looks more like a MacOS

when running the fallowing  exiftool -if '$artist eq ""' -artist="me" dir
I change "me" to what I need the artist to be and dir to a file location
The file I am running on did not currently have an artist.

I would normally run this command to add artist
exiftool -r "$path" -r -overwrite_original -Exif:Artist="$Artist"

I would like to run it and have it only run on the files that are missing artist tag or update file that need it.
Title: Re: Need to rename artist...
Post by: StarGeek on November 04, 2021, 10:42:13 AM
Duplicate post removed.

Check your quotes.  If you're using Windows CMD, then use double quotes on the outside, single inside of that, e.g. -if "$artist eq '' ". The command you have listed would be what you would run under Windows PowerShell/Mac/Linux.

It would be very helpful if you remember to copy/paste you're entire output every time and use the [code][/code] button (https://exiftool.org/forum/Themes/default/images/bbc/code.gif) to format the output (and only the output) properly.
See this post (https://exiftool.org/forum/index.php?topic=4888.msg69111#msg69111)