Author Topic: Exporting specific tags to text file  (Read 2086 times)

GeorgeReis

  • Jr. Member
  • **
  • Posts: 10
Exporting specific tags to text file
« on: June 21, 2012, 01:09:36 PM »
I want to create a text file that has only specific tags written to it, for instance maybe image height and image width. I looked up the tag names and find that they are "ImageHeight" and "ImageWidth." I thought I could write exiftool -ImageHeight -ImageWidth > jpgfile > textfile and that I would end up with a text file with those two data fields. Instead, I get a message in my terminal window stating, "No file specified" and the text file has no data. Can someone tell me what I'm doing wrong?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14555
    • ExifTool Home Page
Re: Exporting specific tags to text file
« Reply #1 on: June 21, 2012, 01:21:49 PM »
Try this:

1) Type "exiftool -w txt -imageheight -imagewidth" followed by a SPACE in a Windows cmd.exe or OS X Terminal window.

2) Drag and drop any image file onto the window (it should type the file name for you)

3) Press RETURN

You should then get a ".txt" file with the same name as the image file in the same folder.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

GeorgeReis

  • Jr. Member
  • **
  • Posts: 10
Re: Exporting specific tags to text file
« Reply #2 on: June 21, 2012, 01:51:39 PM »
Excellent - this worked perfectly!

Now, suppose that I wanted to batch process. It seems that I may want to process all files in a folder and get separate files for each; or, I may want to process all files in a folder and get a single file. Are either or both of these possible?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14555
    • ExifTool Home Page
Re: Exporting specific tags to text file
« Reply #3 on: June 21, 2012, 02:02:24 PM »
I may want to process all files in a folder and get separate files for each;

Try the above technique, but drop one or more folders instead of a file.

Quote
or, I may want to process all files in a folder and get a single file

That is where the output redirection comes in:

1) Type "exiftool -imageheight -imagewidth" followed by a SPACE

2) Drop files and/or folders onto the terminal window (add spaces between if necessary)

3) Type " > out.txt" then press RETURN in the terminal window

You will now have a file called "out.txt" in the same directory as reported by the "pwd" command in the terminal.

Adding the -r option to either command will also process images in folders inside these folders, etc, recursively.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).