But .txt is not the same as .rs; yet .txt is not the same as .docx, although both of these files look the same to the human eye.

  • MoonManKipper@lemmy.world
    link
    fedilink
    English
    arrow-up
    18
    ·
    15 hours ago

    There are thousands of types of file. They all contain data as a long sequence of numbers, and how those numbers are interpreted depends on the type of file - text characters, floating point numbers, pixel colour information or compressed data

      • Aniki@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        48 minutes ago

        an image, technically, is an array of pixels. specifically a 2-dimensional array. this means, it’s just a long list of lists of pixels. so if you have a 1920x1080 image, it’s just a list of 1080 lists of 1920 pixels each.

        each pixel, again, is a tuple (i.e. a list with fixed length) of numbers which specify the brightness of red / green / blue lamp. so if you want to display a yellow pixel, the data would be (1.0, 1.0, 0.0) which turns red and green on and blue off.

        so if you have a 1920x1080 image, technically you have 1920*1080*3 ≈ 6 million numbers. each number takes 32-bit, you can read it here

      • MoonManKipper@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        ·
        14 hours ago

        Depends on the file format. There is compressed and uncompressed audio - some times the numbers just represent the audio waveform (e.g. .wav) - some times with lossy lossless compression. Most, but not all, video formats are compressed due to the data size