I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2008-01-13 16:34:41-08 by snah
function -tagsfromfile for 500+ images
Hello

I have some 500+ panoramic images (PSD) in various folders. For those I wish to add certain EXIF data from one of the source files of the panorama image.
The source files are located one <DIR>-level above the actual panorama.
\converted> -source files (TIF)
\converted\PTGUI> -panoramic files (PSD)

The following comandline does exactly what I want for one panoramic image when executed from the same folder where the PSD-file is located.

exiftool -tagsfromfile ..\img22088.tif -exif:fnumber -exif:exposuretime -exif:datetimeoriginal -exif:createdate 22088-22091.psd

I'd like this command line to be executed for some 500+ panoramic shots. But I am not able to figure out how this could be achieved the best way.
Also I am not sure is '-tagsfromfile' works in conjuction with filelists.
I can create the list of files (DIR *.psd /B /S) to be executed but I don't know how to make the commandline work in order to process for each filename in the filelist.

Below is a portion of the filelist of file to be executed:
G:\IMAGES\2006\12_13 ECC Basel\converted\PTGUI\22088-22091.psd
G:\IMAGES\2006\12_16 ECC Basel\converted\PTGUI\23547-23550_rect.psd
G:\IMAGES\2006\12_16 ECC Basel\converted\PTGUI\23547-23550_sph.psd
G:\IMAGES\2006\12_16 ECC Basel\converted\PTGUI\23604-23606_1_cutout.psd

The files with the relevant EXIF data for each PSD-file are always one level higher in:
G:\IMAGES\2006\12_13 ECC Basel\converted\img22088.tif

The command above represents this with a [..\].

To make things simpler (smile) all TIF files are preceeded by [img] and foldernames contain spaces:
G:\IMAGES\2006\12_13 ECC Basel\converted\img22088.tif
G:\IMAGES\2006\12_13 ECC Basel\converted\img22089.tif
G:\IMAGES\2006\12_13 ECC Basel\converted\img22090.tif
G:\IMAGES\2006\12_13 ECC Basel\converted\img22091.tif

Ideally the commandline should perform the following steps:
1 -find the PSD-file according to the filelist
2 -extract a portion of the PSD-filename (first 5 numbers, eg. '22088')
3 -'move back' one <DIR>-level
4 -use the extracted portion of the PSD-Filename, add [img] in front and [.tif] at the end
5 -find that TIF-file, (eg. img22088.tif)
6 -read EXIF Data from TIF-File
7 -write EXIF Data to PSD-File
8 -proceed to next PSD instance in filelist

I would assume that steps 2-4 could be handled by a filelist containing one TIF filename ('img22088.tif') for each PSD instance (22088-22091.psd).

Now I hope someone has some spare time and is willing to look into this request for a solution.
Also please don't hesitate to contact me if further (or clearer) explanation is needed.

Thank you for your consideration,
Hans

Direct Responses: 6862 | Write a response
Posted on 2008-01-13 17:10:00-08 by exiftool in response to 6861
Re: function -tagsfromfile for 500+ images
Hi Hans,

This should do what you want: Run this command from inside the directory containing the tiff images --

exiftool -tagsfromfile img%.5f.tiff -exif:fnumber -exif:exposuretime -exif:datetimeoriginal -exif:c +reatedate PSD_FILES

Here, PSD_FILES is a list of PSD files or the name of a directory containing the images.

There are other ways to do this, but this is the first that comes to mind. See the -w option documentation for a description of what "img%.5f.tiff" does.

- Phil
Direct Responses: 6863 | Write a response
Posted on 2008-01-13 17:11:28-08 by exiftool in response to 6862
Re: function -tagsfromfile for 500+ images
Ooops. Change that to "img%.5f.tif" since you use the 3-character TIFF extension.

- Phil
Direct Responses: 6864 | Write a response
Posted on 2008-01-13 17:14:10-08 by exiftool in response to 6863
Re: function -tagsfromfile for 500+ images
Wrong again. Sorry, I'm in a rush and made another mistake. It should be "img%5f.tif", which takes the first 5 characters. Adding the "." causes the first 5 characters to be skipped, which was wrong.

OK. Gotta run. I hope this works.

- Phil
Direct Responses: 6865 | Write a response
Posted on 2008-01-13 20:08:38-08 by snah in response to 6864
Re: function -tagsfromfile for 500+ images
Hi Phil

Thanks for your quick advice, it worked partially. The parameter "img%5f.tif" does the job fine when called from the folder where the PSD file is located.

Once I use it with the PSD_Filelist, the variable gets the value 'filel' * from somewhere, but it does not take the Filename (see below).
* seems as the 'l' is an 'l' like 'little' and not a '1' like 'one'

C:\Images\2008\01_05 Hotel Margna\converted\PTGUI>exiftool -tagsfromfile ..\img% 5f.tif -exif:fnumber -exif:exposuretime -exif:datetimeoriginal -exif:createdate c:\images\filelist-test1.txt Error: Error opening file - ..\imgfilel.tif 0 image files updated 1 files weren't updated due to errors

Below samples of the file-list-test1.txt

70021-70030.psd 70038-70050.psd

I tried with and without path forward and backslash, the result of the variable 'img%5f.tif' remained unchanged in all error-messages (=imgfilel.tif.

/IMAGES/2008/01_05 Hotel Margna/converted/PTGUI/70021-70030.psd /IMAGES/2008/01_07 Maloja/converted/PTGUI/70038-70050.psd

Still, how will we accomplish to move in the many Directories where the PSDs are located ?
To me it seems as in this case the filelist.txt is the key of navigating sequentially among the many directories.
I've got some 858 such PSD files in about 450 different directories.

Hope you had some ideas while gone - we are getting closer
Hans
Direct Responses: 6866 | Write a response
Posted on 2008-01-13 20:35:46-08 by exiftool in response to 6865
Re: function -tagsfromfile for 500+ images
I didn't appreciate that the PSD images were in all different directories. Is the last directory name always a constant length? (ie. is it always "PTGUI"?) If so, then we can still get things to work.

The next problem is that you need to use the "-@ ARGFILE" option to read arguments (ie. all your filenames) from a text file.

Something like this may work if your last directory name is a constant length (5 chars):

exiftool -tagsfromfile %-.6d/img%5f.tif -exif:fnumber -exif:exposuretime -exif:datetimeoriginal -ex +if:createdate -@ file-list-test1.txt

Here I remove the last 6 characters from the directory name (with "%-.6d") to also remove the "/" before "PTGUI", which I then add back again.

- Phil
Direct Responses: 6867 | Write a response
Posted on 2008-01-13 21:37:27-08 by snah in response to 6866
Re: function -tagsfromfile for 500+ images
Dear Phil,

you're so fast.
Yes, 'PTGUI' in my case is universal.

I tried the new cmd-line as follows:

C:\Images\2008\01_05 Hotel Margna\converted\PTGUI>exiftool -tagsfromfile %-.6d/img%5f.tif -exif:fnu +mber -exif:exposuretime -exif:datetimeoriginal -exif:createdate -@ \images\filelist-test1.txt Error: Error opening file - /img70021.tif Error: Error opening file - /img70038.tif 0 image files updated 2 files weren't updated due to errors C:\Images\2008\01_05 Hotel Margna\converted\PTGUI>

Looks much better. The variable has the correct values for the filename.
But there seems to be a navigation problem with the path.
The underlying TIF files are always located in '\converted' one level above the PSD in '\PTGUI'.

What format does the filelist-test1.txt require?
Full pathname, File name, forward or backslash?
Where exactly do I need to invoke the CMD-line? I tried at c:\images but the resulting error-msg remained equal.

I created listing for all PSD files like this:

C:\Images>exiftool -p psd-list.txt -r -ext .psd * >filelist-test1.txt

The contents are as follows
2008/01_05 Hotel Margna/converted/PTGUI/70021-70030.psd 2008/01_07 Maloja/converted/PTGUI/70038-70050.psd


I am sorry, but I am not so good on fine-tunning the variables. Hope you won't mind to fiddle a bit more with this.

For some relaxation you might want to check-out some beautyful images of clear BLACK-ICE near St.Moritz.BLACK-ICE
Direct Responses: 6868 | Write a response
Posted on 2008-01-13 23:53:51-08 by exiftool in response to 6867
Re: function -tagsfromfile for 500+ images
It worries me that the %d isn't working as expected. You may have to run a few tests to see what is going on here (try "%d" instead of "%-.6d" maybe to see if the directory name gets passed through properly). Also, there is a simpler alternative to going up one directory level that I know will work in Unix but I'm not sure about windows: Simply add "../" to the directory to go up one level. For this you would have "-tagsfromfile %d../%f.tif". If this works it is simpler.

I guess I'm not sure why you want to use a .txt file containing the filenames when you can just run exiftool on the entire directory structure using "-r -ext psd *" as you did when generating the list. Whichever you want to do should work, but it would be easier without the intermediate files. But of course, you want to be sure the command is doing what you want on a few files before you run it on all 500.

The command should be executed in the directory from which the path names to the PSD files is valid. ExifTool converts all backslashes to forward slashes, so either should work.

- Phil
Direct Responses: 6870 | Write a response
Posted on 2008-01-14 10:57:28-08 by snah in response to 6868
Re: function -tagsfromfile for 500+ images
YESSSS, your 'Unix' suggestion works just fine.
Thank you very much, Phil.

This is the solution for those who may have a similar issue:

C:\>exiftool -tagsfromfile %d../img%5f.tif -exif:fnumber -exif:exposuretime -exif:datetimeoriginal +-exif:createdate -@ c:\images\filelist-test.txt /IMAGES/2008/01_05 Hotel Margna/converted/PTGUI/../img70021.tif /IMAGES/2008/01_07 Maloja/converted/PTGUI/../img70038.tif 2 image files updated C:\>

Comments:
- Filelist-text.txt contains full path/filename
- command can be issued from any 'DIR' level

Hans
Direct Responses: Write a response