Determine if FileType (not file name extension) is appropriate for exiftool

Started by Curtis, November 02, 2014, 09:18:37 PM

Previous topic - Next topic

Curtis

Hi Phil.... (sorry to be a pest....)  :-\

What I'm looking for is a list of FileTypes (strings), (which I would display to the user and allow them to pick from) that I can then use to compare against the FileTypes coming from exiftool (specifically when I'm using the -fast3 option).

For things like JPEG FileType, it may come from a file with really any file name extension, but typically from .jpg.  But FileType returned as a tag value by exiftool would never be JPG, is that correct?  JPG is listed from both -listr and -listf.

It seems like the list of all FileTypes returned as a tag value from exiftool is a subset of what -listr or -listf give and in a few cases as you mentioned the FileType value is valid but not listed in -listr or -listf.

If it is 'easy' would be nice to get the actual list of FileType values that exiftool can possibly return (whether or not they are supported or just recognized).

Below is an attachment showing a screen shot of some pertinent info from my program.  The File Type column is the exiftool FileType tag and the Type column is the file type returned by Windows (just for info).

Thanks so much for your time on this... this is not a critical need...
Curtis



Phil Harvey

Hi Curtis,

What you are requesting is difficult.  Unfortunately, since extensions do not map 1:1 into file types.  (As you point out, as well as multiple FileType's for a single extension, there are also multiple extensions for a single FileType, like JPEG, JPG and JPE for FileType JPEG.)  Also unfortunately, the FileType logic is not centralized in the code, so there is no way to dig out all of the possible FileType values automatically.  But I'll give this a bit of thought.

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

Curtis

Thanks Phil, like I said it is not critical... no need to spend too much time on this.

Thanks!
Curtis

Phil Harvey

Just FYI, here is a list of file types that differ from the extensions from my set of test files:

> exiftool ../pics -if 'uc $fileextension ne $filetype' -fileextension -filetype -T | sort | uniq
aif AIFF
ait AI
azw3 MOBI
cos XML
dcm ACR
dcm DICOM
dic DICOM
djvu DJVU (multi-page)
eip IIQ
epsf EPS
exe ELF executable
exe Mach-O executable
fff FLIR
gz GZIP
htm HTML
icm ICC
indt INDD
jpg CR2
jpg JPEG
lfr LFP
m4a MP4
m4v MP4
mov MP4
mp4 M4P
mpg MPEG
mts M2TS
nrw NEF
ogg OGV
pct PICT
pspimage PSP
qt MOV
tif Canon 1D RAW
tif IIQ
tif TIFF
tiff IIQ
torrent Torrent
ts M2T
...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 ($).

Curtis

Thanks Phil, I appreciate the list... pretty cool how you can use exiftool to make such a list so easily!