The post has been translated automatically. Original language: Russian
ZIP is often perceived as a "make file smaller" button. But if you take a folder with documents, it can actually decrease noticeably, and if you archive photos or videos, the size will hardly change. And this is not because the archiver "did not work well".The main goal of ZIP is not to reduce files at any cost. First, it collects many individual files and folders into one archive, preserving their names and structure. Therefore, instead of a folder of dozens of documents, you can send one file, and the recipient will then unpack it and receive everything in approximately the same form.And after that, ZIP tries to save space. To do this, it searches for repetitive sequences and patterns in the data. If some information is found over and over again, it can be written down more compactly, and restored when unpacking. That's why texts, tables, program files, and large amounts of similar data sometimes compress very well.
The situation is different with photos and videos. JPEG, MP3, or MP4 formats were originally created to take up less space. Most of what could be compressed had already been processed before. Therefore, if you put 1 GB of photos in a ZIP and get a 980 MB archive, this is completely normal. The archiver simply had almost nothing to shorten.At the same time, the ZIP should not degrade the quality of the photo or document. The usual ZIP compression is designed so that after unpacking you get the same data that you had before archiving. Therefore, this is not the same as reducing the image quality or re-encoding the video for a smaller size.
ZIP has another useful feature that is often overlooked: the convenience of transmission. It can be inconvenient to send one folder of 70 files directly - in some cases it will not be possible to attach the entire folder, in others the files will be uploaded separately. ZIP turns all of this into a single object that is easier to download, forward, and save.
It turns out that ZIP does two different jobs at the same time: it packs many files into one and, if possible, reduces their total size.Therefore, an archive that has hardly become smaller is not a useless archive. Sometimes his main task is not to "lose weight", but simply to carefully put everything into one package.
ZIP часто воспринимают как кнопку «сделать файл меньше». Но если взять папку с документами, она действительно может заметно уменьшиться, а если заархивировать фотографии или видео - размер почти не изменится. И это не потому, что архиватор «плохо сработал».
Главная задача ZIP вообще не в том, чтобы любой ценой уменьшить файлы. Сначала он собирает множество отдельных файлов и папок в один архив, сохраняя их названия и структуру. Поэтому вместо папки из десятков документов можно отправить один файл, а получатель потом распакует его и получит всё примерно в том же виде.
А уже после этого ZIP пытается сэкономить место. Для этого он ищет в данных повторяющиеся последовательности и закономерности. Если какая-то информация встречается снова и снова, её можно записать более компактно, а при распаковке восстановить обратно. Поэтому тексты, таблицы, программные файлы и большие массивы похожих данных иногда сжимаются очень хорошо.
С фотографиями и видео ситуация другая. Форматы JPEG, MP3 или MP4 уже изначально созданы так, чтобы занимать меньше места. Большая часть того, что можно было сжать, уже была обработана раньше. Поэтому если положить 1 ГБ фотографий в ZIP и получить архив на 980 МБ — это совершенно нормально. Архиватору просто почти нечего было сокращать.
При этом ZIP не должен ухудшать качество фотографии или документа. Обычное ZIP-сжатие устроено так, чтобы после распаковки получить те же данные, которые были до архивации. Поэтому это совсем не то же самое, что уменьшить качество изображения или перекодировать видео ради меньшего размера.
Есть у ZIP и ещё одна полезная функция, про которую часто забывают: удобство передачи. Отправить одну папку из 70 файлов напрямую бывает неудобно - где-то не получится прикрепить папку целиком, где-то файлы загрузятся по отдельности. ZIP превращает всё это в один объект, который проще скачать, переслать и сохранить.
Получается, ZIP делает две разные работы одновременно: упаковывает много файлов в один и, если получается, уменьшает их общий размер.
Поэтому архив, который почти не стал меньше, - не бесполезный архив. Иногда его главная задача не «похудеть», а просто аккуратно собрать всё в одну упаковку.