Saturday, February 24, 2024
 Popular · Latest · Hot · Upcoming
12
rated 0 times [  12] [ 0]  / answers: 1 / hits: 7587  / 2 Years ago, wed, december 29, 2021, 12:40:04

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?


More From » file-format

 Answers
3

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

[#10934] Thursday, December 30, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
breadoules

Total Points: 212
Total Questions: 118
Total Answers: 120

Location: Dominica
Member since Mon, Jun 22, 2020
4 Years ago
;