Example: I have a book which I wanna archive. Would sending a zip with the pages take less storage than sending the, let’s say, 10 individual pages sparatedly?

  • Scott@lem.free.as
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    17 hours ago

    I’m not quite sure what you’re asking.

    ZIP, by default, is a compression tool. It takes multiple files, creates an index of the files within and then performs compression on all the files combined (to allow for a better dictionary). The index and dictionary are “overhead” that exists for each ZIP file.

    Sending multiple files, uncompressed, or sending multiple ZIP files (one for each file) will almost certainly be less efficient.

    • Meow-Misfit@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      16 hours ago

      Example: Book A I have all 10 pages of it in a jpg each.

      Let’s say the size of all these 10 pages togheter is 300MB (not tech savy, don’t know if this is realistic).

      If I put them on a zip, will the size be smaller? Like, reduce to 250MB or something?

      • klangcola@reddthat.com
        link
        fedilink
        arrow-up
        3
        ·
        4 hours ago

        For jpg’s, no they will not get smaller. Maybe even a smidge bigger if you zip them. Usually not enough to make a practical difference.

        Zip does generic lossless compression, meaning it can be extracted for a bit-perfect copy of the original. Very simplified it works by finding patterns repeating and replacing a long pattern with a short key, and storing an index to replace the keys with the original pattern on extraction.

        Jpg’s use lossy compression, meaning some detail is lost and can never be reproduced. Jpg is highly optimized to only drop details that don’t matter much for human perception of the image.

        Since jpg is already compressed, there will not be any repeating patterns (duplicate information) for the zip algorithm to find.

      • slazer2au@lemmy.world
        link
        fedilink
        English
        arrow-up
        5
        ·
        16 hours ago

        For images it may be better but images are already compressed so there may not be a large saving in zipping them.

        Alternative options would be to use more storage efficient formats like webp for instance.