Insert metadata of central wavelenghts and bands in tif file

Started by jlapajne, October 30, 2020, 10:43:13 AM

Previous topic - Next topic

jlapajne

Hello,
I have been tring this for a long time, but didnt succeed, thats why I decided I will post here and hope for someone to help.

I am dealing with multispectral photos and I would like to include information about band, wavelenght etc. into metadata of images. Each image represents separate band which is stored as a tif file.
Into separate image I need to include many tags, that is why I am doing it with csv file.

Here is my procedure:
First I create csv file with metadata information I want to include into images. You can see it here where I aligned it for easier visualisation. Also I included just one line.

Than I run the command:
path_to_exiftool -csv="csv_file_path" -overwrite_original output_images_path

The command terminate succefully and I inspect images with:
path_to_exiftool -csv -r -All output_images_path > output.csv

At this point I see that metadata about band, wavelenghts is not included in images. However some metadata is included (GPS data)

Can someone please tell me what am I doing wrong and what else could I try?
I will appriciate any help. Thank you in advance!

StarGeek Edit: fixed link

StarGeek

What is the actual tag you are trying to write, including the Group (add -G1 when listing output)?  From what I can see searching through the Tag Names pages, the Blacklevel tag only appears on various Camera MakerNotes pages (Canon, Nikon, Olympus, Sony, FujiFilm).  MakerNotes cannot be created individually, only edited in existing MakerNotes blocks (see FAQ #23).
"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

jlapajne

Hello, thank you for your answer. For now would be enough if I could write this data https://prnt.sc/va7wu6. Among those BandName and centerWavelenght are mising in metadata.

StarGeek

Do you have an image with this data?  If so, what group is the data located in.  Use exiftool -G1 -a -s FILE to see all tags and the groups they belong to.

My quick search of the Tag Names pages doesn't reveal a Bandname or CenterWavelength tag.

Of the rest of those tags, most are writable.  The other exceptions are FocalPlaneXResolution, FocalPlaneYResolution, and FocalPlaneResolutionUnit.  These tags are not writable.
"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


StarGeek

BandName is part of the XMP-Camera group, which exiftool can't write by default, but it looks like it can be written with the config file in this post

Ah, even better, this post has a config file for both the XMP-Camera tags and the XMP-DLS tags, of which CenterWavelength is part of.  So download the file attached to that post and save it in the same directory as exiftool.  Then start any command in which you want to write BandName or CenterWavelength with
exiftool -config MicaSense.config

As for BlackLevel, I missed that it is also part of the EXIF group.  It is tagged as Unsafe so it is not written unless specified explicitly.  But I can't seem to write it directly, so hopefully Phil can comment on that.
"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

Phil Harvey

BlackLevel is writable, but the default write location is the SubIFD because this is used in DNG files.  So it won't get written if the SubIFD doesn't exist.  You can write it elsewhere if you want, but you would have to specify the location.  However, it isn't meant for this purpose.

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

jlapajne

Thank you both for your answers! It now finally works. I am asking myself why I didnt post it earlier - it would save me quite some time.

About blackLevel -  I dont actually need to include it..it just came in the middle of everything, because I was begining to try every option what else need to be included.

Anyways, it seems that now Bandname and Wavelength are included in metadata.
I checked it with proposed method:
exiftool -G1 -a -s FILE

There is just one slight thing I think I need to change, because it throws me a warning when I execute metadata writing:
Warning: [minor] Fixed incorrect tag ID case for XMP-Camera:Bandname

I include bandname and Wavelenght in header as:
XMP-Camera:Bandname
XMP-DLS:CenterWavelength

For CenterWavelength there is no warning.




StarGeek

Quote from: jlapajne on October 31, 2020, 09:40:30 AM
There is just one slight thing I think I need to change, because it throws me a warning when I execute metadata writing:
Warning: [minor] Fixed incorrect tag ID case for XMP-Camera:Bandname

Nothing you need to change.  As it says, it's a minor warning and it has been fixed.  The problem is that the data in your file lists that tag as BandName, but the config file used to write it uses Bandname.  It's very unlikely to cause a problem unless the software that reads it is very badly written.

Though, checking that config file, I notice that it has two listings for BandName, one with upper case N and one with lower case n.  And I would suspect that the one with the upper case N would be correct.  If  you like, you could edit the config file and remove this line
Bandname => { },
"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

jlapajne

Oh thanks. Yes I removed the one witn the n and the problem is...gone! Thanks a lot!

jlapajne

Hello, me again. Previously proposed methods how to insert metadata into image work, but I decided to ask, if there exist better, more elegant method to do the insertion.

Images with which I am working include quite a lot of tags. Those tags are lost after I read-process-save the image.
If it is possible I would like to copy all the tags from image before processing and insert it into images saved after processing.

I was thinking to do something like this:

path_to_exiftool -config path_to_micasense.config -csv -r -All path_to_images > output.csv

path_to_exiftool -config path_to_micasense.config -csv output.csv -overwrite_original path_to_images


The problem I think is that the images I am dealing with include special config, so this way values and tags are not inserted from image before processing to image after processing.
My question is than is it even possible to insert metadata this way or must I do it for each tag separately?

Here https://drive.google.com/drive/folders/1Za-UyD_UMIXSnr_ITjgvTGcDN5wCKUg9?usp=sharing is an example of two images, where one includes all metadata and other none. In this case I just saved the same image without metadata.

Thank you in advance.

StarGeek

I would suggest copying the data as a block to exiftool's own MIE sidecar files, then copying back afterwords.  This can copy data as a block so it would copy all tags, even unknown ones that would require a config file.

First, batch create the sidecards.  This command will copy all the EXIF and XMP tags as a block, which would include tags exiftool might not know about, without the need for a config file.  Include other groups, such as ICC_Profiles, as needed.
exiftool -tagsfromfile @ -EXIF -XMP -srcfile %d%f.MIE /path/to/files/

Then afterwards, copy the blocks back into the files
exiftool -tagsfromfile %d%f.MIE -EXIF -XMP /path/to/files/

At least I think I have that correct.  Test it out first (and hopefully Phil will correct if need be).
See MIE sidecar files for more details.

Also, if the output files are in a different directory than the originals, then you can just copy directly from the originals to the output files, skipping the sidecar file.
exiftool -TagsFromFile /path/to/originals/%F -EXIF -XMP /path/to/edited/
"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

jlapajne

Hey, thanks for reply, but the first command somehow dont work. It says that @ does not exist for -tagsFromFile option? Should I change it somehow? Additionaly should I first put images with metadata in the folder  (/path/to/files/) and than save metadata. Than delete those with metadata and substitude them with images without metadata and then run the second command?

StarGeek

Can you copy/paste the command and output from that command?  And confirm you're using it directly on the command line, not in a bat file or something?  It work correctly here
C:\>exiftool -tagsfromfile @ -EXIF -XMP -srcfile %d%f.MIE y:\!temp\Test4.jpg
    1 image files created


Quote from: jlapajne on November 05, 2020, 04:35:35 PMAdditionaly should I first put images with metadata in the folder  (/path/to/files/) and than save metadata. Than delete those with metadata and substitude them with images without metadata and then run the second command?

That would be up to you, however you want to go about it.
"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

jlapajne

I just substituted "@" with @ and it works. Probably windows problems? Anyways, I succesfully included XMP tags, but did not succeed to include GPS, ExifIFD and IFD0 tags. I did the following:

exiftool -TagsFromFile /path/to/originals/%F -EXIF -XMP -IFD0 -GPS -ExifIFD /path/to/edited/


Should I include some extra flags?