promotion image of download ymail app
Promoted

computer science?

can someone explain to me what exactly lossless compression does

im confused at the part where it supposedly reconstructs the file using compression but still manages to have a smaller file size. Isnt that loss of data????

3 Answers

Relevance
  • Cantra
    Lv 7
    1 year ago
    Favourite answer

    Lossy compression genuinely loses data in that it will disregard things and not include them in the compressed version. They are approximations and averages used to represent the original content. The uncompressed file cannot be reconstructed from this as data has been changed or is missing.

    Lossless compression does not do this, the original uncompressed file can be perfectly reconstructed from the compressed version. While the compressed file has technically 'lost' data, the way the compression works is that it looks for redundancies and changes sections of data to pointers that reference an earlier section of data. To grossly oversimplify, if the data is 'I am what I am', then because 'I' and 'am' are duplicated, the compressed file could replace that data with a pointer to the original 'I' and 'am'. So the compressed file is slightly smaller, but the full original can be recreated from it. Ultimately nothing is 'lost'.

    • Commenter avatarLog in to reply to the answers
  • 1 year ago

    Some older programs did replacing the sequences of spaces by TAB statements. It was loosless, too.

    https://word.tips.net/T000851_Replacing_Multiple_S...

    • oyubir
      Lv 6
      1 year agoReport

      No it isn't. It isn't lossless, since you can't, after this operation, distinguish between a file with 1 tab and a file with 8 spaces. You have lost information. Meaningless information (well, I guess, in the context). But information tho. By definition, it is not lossless.

    • Commenter avatarLog in to reply to the answers
  • John R
    Lv 7
    1 year ago

    computer data consists of ones and zeros. Compression works two ways - first it eliminates repetition.

    if there is a section of the data that consists of a 1000 zeros in a row, instead of writing 0 1000 times, compression software just includes the instruction to "put 1000 zeros in this spot"

    The next thing is does is to use a library of shorter segments to replace commonly used longer segments. The English equivalent is to use abbreviations, much like typing Mr. for Mister or Apt. for apartment, but on a larger scale.

    Not all data compresses well. Some file types use built in compression. For example, bitmaps - .bmp files compress a great deal because they contain a lot of repetitious data. .JPG files have compression included in the file format, so if you attempt to compress them further you gain little. In fact, if you zip a .jpg the file may actually increase in size.

    • Commenter avatarLog in to reply to the answers
Still have questions? Get answers by asking now.