FileType and FileTypeExtension - difference

Started by theprof, November 07, 2024, 08:14:57 AM

Previous topic - Next topic

theprof

1) Will FileType always be uppercase?
2) Will FileTypeExtension always be uppercase?
3) What is the difference between FileType and FileTypeExtension ? I'm assuming that FileTypeExtension comes from the actual file name and that FileType comes from the EXIF metadata. Meaning that FileTypeExtension could be jpg but FileType could be PNG or FileTypeExtension could be mp4 but FileType could be mpg.

Phil Harvey

1) No

2) Yes, if -n is used. Otherwise lowercase

3) No. They correspond to each other, but FileType may include some more details about the specific file type.

- Phil

Edit. Fixed answer to 2
...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 ($).

StarGeek

As always, too slow :D

Quote from: theprof on November 07, 2024, 08:14:57 AM1) Will FileType always be uppercase?

I think so, but Phil will have to say for certain.

Quote2) Will FileTypeExtension always be uppercase?

I assume you mean lowercase for FileTypeExtension

From the source code on the FileTypeExtension
Quotea common lowercase extension for this file type, or uppercase with the -n option

Quote3) What is the difference between FileType and FileTypeExtension ?

Filetype is the name for the type of file. For example, JPEG. FileTypeExtension is the standard file extension for that type of file. JPEGs more commonly have an extension of "jpg". There are probably other file types that have this difference.

QuoteI'm assuming that FileTypeExtension comes from the actual file name and that FileType comes from the EXIF metadata.

The FileType is figured out by analyzing the structure of the file. You can't read EXIF data unless you know what kind of file it is and most file types can't contain EXIF data. Most of the time it is quickly figured out by the finding the Magic number, the byte sequence, that is unique and indicates the file type.

For FileTypeExtension, it's just a lookup table taken from the FileType.

I think there might be a couple of exceptions in the MP4 based audio formats, like m4a/m4b, as there isn't much of a difference between the two. At least, I remember there was a topic along these lines either on these forums or GitHub.

QuoteMeaning that FileTypeExtension could be jpg but FileType could be PNG or FileTypeExtension could be mp4 but FileType could be mpg.

No. The FileTypeExtension will match the FileType.
"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

@StarGeek:  I said "no" to question 1 because although any extension in the FileType value will be uppercase, it may also contain mixed case descriptive elements.  Here is a list from the test files in the full ExifTool distribution, with FileTypeExtension on the left (-n was not used) and FileType on the right.

a Mach-O static library
aa AA
aac AAC
aae AAE
afm AFM
aiff AIFF
ape APE
avi AVI
bmp BMP
bpg BPG
btf BTF
cr2 CR2
cr3 CR3
crw CRW
csv CSV
czi CZI
dcm DICOM
dfont DFONT
djvu DJVU (multi-page)
dng DNG
docx DOCX
dpx DPX
dr4 DR4
dss DSS
dv DV
dylib Mach-O dynamic link library
eip EIP
eps EPS
exe Win32 EXE
exr EXR
fits FITS
flac FLAC
flif FLIF
flv FLV
fpf FPF
gif GIF
gz GZIP
hdr HDR
heif HEIF
html HTML
icc ICC
ico ICO
ics ICS
iiq IIQ
indd INDD
inx INX
iso ISO
itc ITC
j2c J2C
jp2 JP2
jpg JPEG
jps JPS
json JSON
jxl JXL
jxl JXL Codestream
lfp LFP
lnk LNK
m4a M4A
macos MacOS
mie MIE
miff MIFF
mkv MKV
mobi MOBI
moi MOI
mov MOV
mp3 MP3
mpc MPC
mrc MRC
mrw MRW
mts M2TS
mxf MXF
nef NEF
numbers NUMBERS
ods ODS
ogg OGG
opus OPUS
pcd PCD
pcx PCX
pdf PDF
pfa PFA
pfb PFB
pfm PFM
pgf PGF
pict PICT
plist PLIST
pmp PMP
png PNG
ppm PPM
ppt PPT
psd PSD
psp PSP
r3d R3D
ra RA
raf RAF
ram RAM
rar RAR
raw RAW
rm RM
rtf RTF
rw2 RW2
so ELF shared library
svg SVG
swf SWF
tif TIFF
torrent Torrent
ttf TTF
txt TXT
vcf VCard
vrd VRD
wav WAV
webp Extended WEBP
wmv WMV
wpg WPG
wtv WTV
x3f X3F
xcf XCF
xisf XISF
xmp XMP
zip ZIP

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