News:

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

Main Menu

Problem with "tagsfromfile"

Started by Jossie, May 09, 2018, 05:57:24 AM

Previous topic - Next topic

Jossie

Hello,
using EXIFtool-GUI I am trying to write an args-file, which should in the end correct corrupted files from a scanner. To accomplish this, I need to read the image dimensions, save these values and later restore them. So I try to copy ImageWidth and ImageHeight from a source file to a scratch file for later retrieval back to the original file.

In the args file, I have the command "-tagsFromFile %f.dng -subIFD:ImageWidth save_pixelvalues.tif" which produces the following error message:

Invalid TAG name: tagsFromFile %f.dng -subIFD:ImageWidth save_pixelvalues.tif
Warning: Invalid group name 'tagsFromFile %f.dng -subIFD' - ./Neg-002-HDRI0032_bearb.dng
<-END-

What di I do wrong? Any advice would be appreciated.

Hermann-Josef

Phil Harvey

Hi Hermann-Josef,

I think you have a few problems:

1. In ExifToolGUI you don't specify the target file name.  You select this in a file selection dialog.

2. Did you put quotes around all of your arguments?  Somehow they are being interpreted as a single argument.

3. You need to save these to some metadata-only format like XMP, EXV, EXIF or MIE.  ExifTool can not create image files (like TIFF) from thin air.

4. I don't think you want to use -tagsfromfile.  Instead I think you should be doing something like this in the ExifToolGUI exiftool direct box:

-o %d%f.exif "-exifimagewidth<subifd:imagewidth" "-exifimageheight<subifd:imageheight"

Then select the DNG's to be processed.

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

Jossie

Hi Phil,

thanks for looking into this in detail.

The quotes were just in this text to indicate the command I used. There were no quotes in EXIFtool direct in the GUI.

In the meantime a more simple way to solve my problem would be put as follows:

How do I copy all tags from one file to another, except the ImageWidth and ImageHeight for all the subframes contained in the file (soufce and destination is a dng with 3 images in it of different pixel dimensions)?

The width and height must be preserved for all pages, of course, whereas all the other tags can be the same as in the source image.

Many thanks and best wishes

Hermann-Josef

Phil Harvey

Hi Hermann-Josef,

Quote from: Jossie on May 09, 2018, 10:35:22 AM
How do I copy all tags from one file to another, except the ImageWidth and ImageHeight for all the subframes contained in the file (soufce and destination is a dng with 3 images in it of different pixel dimensions)?

Try adding -exif:all to copy all EXIF tags, or -all:all to copy other metadata types too.

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

Jossie

Hi Phil,

I have read the documentation and seen the -all:all. If this also copies the imagewidth and imageheight I cannot use it since these are different between source and destination, which is exactly my main problem.

My problem is how to specify the source and destination images, because I will have to operate the args file over quite a number of images selected in the GUI. I have done this successfully by copying tags from a JPG image to a TIF image with the same name:
# Copies tags to the selected file(s) from the reference as specified in line 2
#
-tagsfromfile
D:/Bildarchiv_temp/SW/%f.jpg
#
#----EXIF----
-EXIF:ImageDescription

This works nicely and I had thought that %f specifies the file name without extension.

Each of the source images has a given name and the corresponding destination image is the same name but with a string added, so I tried %f_string, but that did not work.

Hermann-Josef

Phil Harvey

Quote from: Jossie on May 09, 2018, 11:20:00 AM
I have read the documentation and seen the -all:all. If this also copies the imagewidth and imageheight

It shouldn't.  Which ImageWidth/Height tags are you talking about?  The EXIF ones won't be copied since they are "unsafe".

Quote# Copies tags to the selected file(s) from the reference as specified in line 2
#
-tagsfromfile
D:/Bildarchiv_temp/SW/%f.jpg
#
#----EXIF----
-EXIF:ImageDescription

This works nicely and I had thought that %f specifies the file name without extension.

It does.  You have added ".jpg" as the extension.

QuoteEach of the source images has a given name and the corresponding destination image is the same name but with a string added, so I tried %f_string, but that did not work.

Did you add an extension?

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

Jossie

Hi Phil,

okay, if the imagewidth/height are not copied, that is great.
QuoteWhich ImageWidth/Height tags are you talking about?
There are 3 images in each source and destination and the image dimensions are different. The three images are two reduced-resolution images (IFD0 and IFD1) and one full-resolution image (subIFD). There is also in addition the EXIF:imagewidth/height. All the dimensions in the destination image should not be changed, of course, by the operation.
QuoteDid you add an extension?
Yes. Here is what I have in the args file at the moment, which does not work:
-tagsFromFile DNG-gross.dng -all:all

The image "DNG-gross.dng" is the master, whose tags should be copied to each image selected in the GUI -- except for the image dimensions. I had thought that my example above is the same structure. The destination image is not specified, it is taken from the selection in the GUI.

Hermann-Josef

Phil Harvey

Hi Hermann-Josef,

The only potential problem I see with your command is the location of the master DNG.  It may be safer to specify an absolute path (ie. "c:\path\to\DNG-gross.dng") because I don't know what working directory ExifToolGUI uses.

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

Jossie

Hi Phil,

specifying the complete path to the master image does not help. Still I get the same error message as quoted in my first contribution above: "Invalid TAG name ... "  and  "Invalid group name ...".

Here is the complete log file, now for a Test.tif as destination:

Invalid TAG name: tagsFromFile D:/Hermann-Josef/Pictures/Forumsbeitraege/Bilder_anderer_Mitglieder/Walter/DNG-gross.dng -all:all
Warning: Invalid group name 'tagsFromFile D:/Hermann-Josef/Pictures/Forumsbeitraege/Bilder_anderer_Mitglieder/Walter/DNG-gross.dng -all' - ./Test.tif
<-END-

Why does it only list -all at the end and not -all:all ?

Hermann-Josef

Phil Harvey

There is still some quoting issue somewhere.  I can't help with this with the GUI.

Oh, wait.  You are using a -@ argfile?  Each argument must be on a separate line.

I don't know why the ":all" is missing from the warning, but that certainly isn't part of the problem.

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

Jossie

Hi Phil,

thank you very much for looking into this in this detail!

Now it made a difference, when I corrected the args file. But still there is an error message:

======== ./Neg-002-HDRI0032_bearb.dng
Nothing changed in ./Neg-002-HDRI0032_bearb.dng
    0 image files updated
    1 image files unchanged
Warning: No writable tags set from D:/Hermann-Josef/Pictures/Forumsbeitraege/Bilder_anderer_Mitglieder/Walter/DNG-gross.dng
<-END-

There are writable tags in the master file, e.g. artist, copyright etc. So I do not understand this message. Could it be a problem that these tags already exist in the destination file?

Best wishes

Hermann-Josef

Phil Harvey

Are you sure you got the "-all:all" correct?  Try removing this from the argfile to see what happens.  You can also add a -v3 option to get more details about what ExifTool is doing.

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

Jossie

Hello Phil,

now I removed the absolute path and replaced it as follows:
-tagsFromFile
./DNG-gross.dng
-all:all

With the -v3 I could see that there are a lot of warnings like
Sorry, IFD1:SubfileType is unsafe for writing

But now it works as expected!

Thank you very much for your continuous help!

Best wishes

Hermann-Josef

angelo-sala

Hi, I gather information from different camera manufacturer image files in csv (looping different directories) and it's ok, but of course I have different header and data tags (see below). I would like to import into Excel, but different headers don't make it easy to collect them together. In the sample below i didn't copy all the tags but there are so many. I would get all the information possible. Is there a way to normalize it and have a common format?

Many thanks.
Angelo     

Header 1
SourceFile,AF-CPriority,AF-CSetting,AF-CSpeedTrackingSensitivity,AF-CTrackingSensitivity,AF-CZoneAreaSwitching,AF-SPriority,AFAreaMode,AFAreaModeSetting .....

Header 2
SourceFile,AFAreaMode,AFAreaModeSetting,AFPointSelected,AFPointsUsed,AFTracking, .....

Header 3
SourceFile,About,AF-CPriority,AF-CSetting,AF-CSpeedTrackingSensitivity,AF-CTrackingSensitivity ....

Header 4
SourceFile,ExifToolVersion,FileName,Directory,FileSize,FileModifyDate ....


Phil Harvey

Hi Angelo,

I will split this into a separate topic because you've responded to a topic which is about something totally different.

Are you using the GUI?

To have consistent headers in the -csv output you need to specify the tags you want to extract on the command line.  I don't know how to do this in the GUI.

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