What does the output mean when you do cat image.png
?
Is this what the image actually is made of?
Does it matter what file extension the image has?
cat
will print out the content of the file (zeroes and ones which will be mapped to meaningless characters, because they're not really characters right?) into stdout
which by default is your terminal.
The file extension is for us (humans), to easily figure out what is the type of file; some programs use it to open it too but mostly programs detect the file type using a header inside the file.
Use file file.png
to get the file type, or xxd file.png
:
00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452 .PNG........IHDR
00000010: 0000 0002 0000 0002 0800 0000 0057 dd52 .............W.R
00000020: f800 0000 0e49 4441 5478 9c63 6c60 6062 .....IDATx.cl``b
00000030: 6000 0002 9200 84f7 7ca3 5800 0000 0049 `.......|.X....I
00000040: 454e 44ae 4260 82 END.B`.
to get a hex dump of the file content, notice the "PNG" in the first line.
Also from this file signatures reference we can see that PNG signature is:
PNG 89 50 4E 47 0D 0A 1A 0A PNG image
No comments:
Post a Comment