Let's create an 8x8 black image and save it without extensions in PNG, TIFF, JPEG, TGA and GIF formats using ImageMagick:
magick -size 8x8 xc: -write PNG:a -write TIFF:b -write JPEG:c -write TGA:d GIF:e
Look at the files we made:
-rw-r--r-- 1 mark staff 296 29 Jun 11:09 a # extensionless PNG
-rw-r--r-- 1 mark staff 386 29 Jun 11:09 b # extensionless TIFF
-rw-r--r-- 1 mark staff 160 29 Jun 11:09 c # extensionless JPEG
-rw-r--r-- 1 mark staff 82 29 Jun 11:09 d # extensionless TGA
-rw-r--r-- 1 mark staff 48 29 Jun 11:09 e # extensionless GIF
Now run the file
command on all the files:
file a b c d e
Output
a: PNG image data, 8 x 8, 1-bit grayscale, non-interlaced
b: TIFF image data, little-endian, direntries=15, height=8, bps=16, compression=none, PhotometricIntepretation=BlackIsZero, orientation=upper-left, width=8
c: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 8x8, components 1
d: Targa image data - Mono 8 x 8 x 8 - top
e: GIF image data, version 89a, 8 x 8
Or, as you are on macOS, you can use the built-in sips
. Here I get the format and the dimensions (for added fun):
sips -1 -g format -g pixelWidth -g pixelHeight a b c d e
Output
a| format: png| pixelWidth: 8| pixelHeight: 8|
b| format: tiff| pixelWidth: 8| pixelHeight: 8|
c| format: jpeg| pixelWidth: 8| pixelHeight: 8|
d| format: tga| pixelWidth: 8| pixelHeight: 8|
e| format: gif| pixelWidth: 8| pixelHeight: 8|
Or, you can look at the first few byes of the files with xxd
like this:
for f in ? ; do xxd "$f" | head -1 ; done
Output
00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452 .PNG........IHDR # This one is PNG
00000000: 4949 2a00 8800 0000 ffff ffff ffff ffff II*............. # This one is a TIFF, but "MM" is TIFF in Motorola order rather than II for Intel order
00000000: ffd8 ffe0 0010 4a46 4946 0001 0100 0001 ......JFIF...... # This is a JPEG
00000000: 0000 0300 0000 0000 0000 0000 0800 0800 ................ # This is tough!
00000000: 4749 4638 3961 0800 0800 f000 00ff ffff GIF89a.......... # This is a GIF
identify
? – Interlayfile
command on Os X ? – Lindseylindsley