ExifTool Forum

ExifTool => Newbies => Topic started by: ExifSeeker on September 06, 2017, 10:39:01 AM

Title: Tags in CSV file are divided over multiple rows
Post by: ExifSeeker on September 06, 2017, 10:39:01 AM
Hi,

I'm trying to count how many times Exif tags are being used in images of a large data set.
So I made a csv file with the following command:
exiftool.exe -csv -r -TAG -EXIF:All E:\ > wikiEXIFtags.csv

The output in the CSV file has for many files the content of some Exif tags on the next row.

These are some parts of the output csv file:

E:/en/3/30/Alkatraz_Ridaz_Chapter_2.JPG,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
E:/en/3/30/Allan_Quatermain_and_the_Lost_City_of_Gold.jpg,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"0üI   
         +   +   +                 +   +   +   +   
          +   +   +   +   +         +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +   +    ",,,,,,,,,,,,
E:/en/3/30/Allart_van_Everdingen_Forest_Scene_with_Water-Mill.jpg,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,


E:/en/3/30/Boukenger_VS_Super_Sentai.jpg,,,,,,,,,sRGB,,,JPEG (old-style),,,,,,,,,250,170,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2006:12:19 17:13:11,,,,,,,Horizontal (normal),,,,,,,,,,,,,,,,,,,,inches,,,,,,,,,,,Adobe Photoshop CS Windows,,,,,,,,,,,,,(Binary data 10005 bytes),10005,332,,,,,,,,,,,,,,72,,,72
E:/en/3/30/Bourne_supremacy_ver2.jpg,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," Š      
                                                                
                                                                                                                         ",,,,,,,,,,,,
E:/en/3/30/Bowie_WildIsTheWind.jpg,,,,,,,,,Uncalibrated,,,JPEG (old-style),,,,,,,,,197,200,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2005:12:03 02:40:53,,,,,,,Horizontal (normal),,,,,,,,,,,,,,,,,,,,inches,,,,,,,,,,,Adobe Photoshop 7.0,,,,,,,,,,,,,(Binary data 5266 bytes),5266,324,,,,,,,,,,,,,,72,,,72
E:/en/3/30/BoxTopRobbery.JPG,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,


"E:/en/3/30/Fort_Halifax,_Winslow,_ME.jpg",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
E:/en/3/30/Fourpeaked-glacier-terminus1.JPG,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 75
",,,,,,,,,,,,
E:/en/3/30/Francoisedesevigne.jpg,,,,,,,,,sRGB,"Y, Cb, Cr, -",,JPEG (old-style),,,,,,,,,1555,1212,0220,,,,,,,,,,0100,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2006:07:21 15:58:15,,,,,,,Horizontal (normal),,,,,,,,,,,,,,,0 255 128 255 128 255,,,,,inches,,,,,,,,,,,Adobe Photoshop Elements 3.0 Windows,,,,,,,,,,,,,(Binary data 5806 bytes),5806,448,,,,,,,,,,,,,,300,,Co-sited,300
E:/en/3/30/Frederick_W_Dallinger.jpg,,Library of Congress,,,,,,,Uncalibrated,,,JPEG (old-style),,,,,,,,,5064,3499,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2006:04:25 19:52:02,,,,,,,Horizontal (normal),,,,,,,,,,,,,,,,,,,,inches,,,,,,,,,,,Adobe Photoshop 7.0,,,,,,,,,,,,,(Binary data 9327 bytes),9327,356,,,,,,,,,,,,,,800,,,800


The prompt is also giving some errors and warnings. See below.
Warning: Bad Photoshop IRB resource "\x00\x00\x00\x00" - E:/en/3/30/Hobart_town_Artillery,_Queens_Battery,1869AWM.jpg
Warning: Bad IFD0 directory - E:/en/3/33/East_Jefferson_High_School.jpg
Warning: Bad IPTC data tag (marker 0x0) - E:/en/3/35/CNBC_U.S._-_Business_Center_logo_2003.jpg
Warning: Bad IFD0 directory - E:/en/3/35/Mavic.jpg
Warning: Bad IFD0 directory - E:/en/3/3c/Braystones-station.jpg
Error: File format error - E:/en/3/3f/Rockanore.jpg
Error: Error opening file - E:/en/9/92/Qin_Moon_poster.jpg
Warning: Bad IPTC data tag (marker 0x2) - E:/en/d/d0/Extension_Table_3015.jpg
Warning: Non-standard header for APP1 XMP segment - E:/en/d/d0/PSP_001406_2680_ChasmaBoreale.jpg
Warning: Unrecognized IPTC record 0 (ignored) - E:/en/d/d1/Ged_mich_bb.jpg
Warning: Non-standard header for APP1 XMP segment - E:/en/d/d2/MacbreakWeeklyLogo.jpg
Warning: Bad IPTC data tag (marker 0x0) - E:/en/d/d4/FredFrith_AlbumCover_EleventhHour.jpg
Warning: Bad Photoshop IRB resource "\x00\x00\x00\x00" - E:/en/d/d9/Ellen_Savage_(AWM_061952).jpg
Warning: Bad Photoshop IRB resource "Phot" - E:/en/d/d9/Govada.jpg
Error: File format error - E:/en/d/da/Print100-global.jpg
Warning: ICC_Profile chunk count is zero - E:/en/d/db/De_TeissierArms.jpg
Warning: Bad IPTC data tag (marker 0x2) - E:/en/d/dd/OctopusNAS1.jpg
   39 directories scanned
50000 image files read

but I don't think this is the problem with having tags divided into multiple rows.

I hope someone can help me make the csv having tags for one file on one row.

Thanks
Title: Re: Tags in CSV file are divided over multiple rows
Post by: StarGeek on September 06, 2017, 11:59:39 AM
CSV files are allowed to span rows as long as the data is properly quoted, which is what exiftool does.  If you're importing the file into something like Excel or OpenOffice, there should be some options to check to get it to load correctly.

But otherwise, you can add this option and it will convert all Line Feeds and Carriage Returns into spaces in all the outputted data:
-api "Filter=s/\r|\n/ /g"

The errors you list probably don't affect the CSV output.  A few of those files (the ones with File format error) look like they're just corrupt and may not be viewable.    But check FAQ 20 (https://exiftool.org/faq.html#Q20) if you want to try and fix the metadata on the others.

Edit: Also, remove -TAG from your command.  It doesn't do anything except add an empty column to your CSV.  You're supposed to replace the word TAG with the name of the tag your looking for, as you do with -EXIF:all.
Title: Re: Tags in CSV file are divided over multiple rows
Post by: ExifSeeker on September 07, 2017, 07:47:42 AM
The problem was that when I import the CSV file into Microsoft Excel, for example the UserComment tag was divided into more rows. Whatever was in the CSV file.

Microsoft Excel

[th]SourceFile[/th][th]UserComment[/th]
E:/en/3/30/Allan_Quatermain_and_the_Lost_City_of_Gold.jpg0ⁿI
+++    ++++
+++++++++++++++++++++++++++++++++++++++++++"

When importing the CSV file into OpenOffice Calc it is automatically imported to the correct cell.

OpenOffice Calc

[th]SourceFile[/th][th]UserComment[/th]
E:/en/3/30/Allan_Quatermain_and_the_Lost_City_of_Gold.jpg0üI
+++   ++++
+++++++++++++++++++++++++++++++++++++++++++
E:/en/3/30/Allart_van_Everdingen_Forest_Scene_with_Water-Mill.jpg
E:/en/3/30/All_About_the_Benjamins_DVD_Cover.jpg

ps: I removed -TAG from the command and that gave no changes, I also added -api "Filter=s/\r|\n/ /g" and gave no changes.

But my problem is solved by importing in OpenOffice Calc instead of Microsoft Excel.

Thanks for your help :)
Title: Re: Tags in CSV file are divided over multiple rows
Post by: ExifSeeker on September 08, 2017, 06:45:50 AM
I have an other question because some tags are missing when the -csv option is used.

When I use the following command:
exiftool.exe -csv -r -a -u -s -G1 -e -n -EXIF:All C:\Users\User\Desktop\images\IMG_20170811_104330.jpg > IMG_20170811_104330_4.csv
or
exiftool.exe -csv -r -a -u -s -G1 -e -n C:\Users\User\Desktop\images\IMG_20170811_104330.jpg > IMG_20170811_104330_3.csv
I don't get the ExifOffset, GPSInfo, InteropOffset tags. and I don't want to explicitly cal them because I want to be sure that I get all the Exif tags (and if its possible only the Exif tags).

I also get only one MakerNotes tag but the image has multiple MakerNotes.

Does anyone know how to get all these tags to the output csv?

Thank you
Title: Re: Tags in CSV file are divided over multiple rows
Post by: StarGeek on September 08, 2017, 03:33:42 PM
I don't believe you can get those items because they aren't really tags.  They're pointers in the EXIF structure to various sections of the EXIF data.  For example, GPSInfo points to the GPS IFD.  That's why when you look at these items on the EXIF tag page (https://exiftool.org/TagNames/EXIF.html), two of them link right back to the same page and the GPSInfo links to the GPS page.

MakerNotes isn't a single tag either.  It's a Shortcut tag (https://exiftool.org/TagNames/Shortcuts.html) to make it easy to show the various proprietary camera tag groups.
Title: Re: Tags in CSV file are divided over multiple rows
Post by: ExifSeeker on September 09, 2017, 01:29:39 PM
Thanks for your reaction StarGeek.

I know that the ExifOffset, GPSInfo and InteropOffset tags are pointers to other tags but that doesn't mean that these are not tags. In the Exif specification (http://www.cipa.jp/std/documents/e/DC-008-Translation-2016-E.pdf) in Table 17 the ExifOffset is Called Exif tag and the field name is ExifIFDPointer. This tag has the same structure as for example the ImageWidth if it is using the LONG type.

The Makernote tag with tag ID 927C (hex) has like the UserComment tag no standard defined type and count. So in fact these are real Exif tags and have to be interpreted on the same way as other tags.

Maybe it's not supported by Exiftool to output these tags to a CSV file. I thought maybe it's possible with the -b (binary) and/or -n (No print conversion) options, but I have not succeeded yet.
Title: Re: Tags in CSV file are divided over multiple rows
Post by: StarGeek on September 09, 2017, 02:04:14 PM
You'll probably have to wait for Phil to answer this but it may be a while as he's currently on vacation (https://exiftool.org/forum/index.php/topic,8509.msg43761.html#msg43761).
Title: Re: Tags in CSV file are divided over multiple rows
Post by: Phil Harvey on September 18, 2017, 08:48:03 AM
ExifTool doesn't generate tags for IFD offsets such as ExifOffset or GPSInfo.  The MakerNotes may be extracted as a binary data block if necessary.

- Phil