Everything we need to know about file compression
File compression helps to transfer files easily and quickly and save memory space, and there are several methods and algorithms available for this.
There are several known methods for compressing a file. Each of these methods has different definitions and ideas and produces different results for different types of data; But all of these methods are based on the same principle: compress the data by removing the redundancy of the original source file data. This article addresses a variety of compression methods, the benefits of compression, and data compression procedures.
File compression
Data compression is used almost everywhere. Many file types use compressed data. Without data compression, the volume of a 3-minute music video will be approximately 100 MB, and the volume of a 10-minute video can be up to 1 GB. In data compression, large file sizes can be reduced by deleting unnecessary data while preserving information.
Data compression can be interpreted as reducing the number of bits required to display data. Data compression can save memory capacity, increase file transfer speed, and reduce memory cost and network capacity.
Lossless compression
In data compression without data loss, algorithms are used that allow the recovery of the original data from the compressed file. This method is opposed to lossy compression, which does not allow data to be recovered from a compressed file.
No-loss compression is used when the original file is identical to the file being decompressed. Most lossless compression programs use two types of algorithms: one is used to generate a statistical model of the input data, and the other is used to represent the input data in bit strings using this model.
Lossless compression is a common method for executable files as well as text files and spreadsheets; Because in this type of files, the loss of words or numbers can change the information. The most popular compression formats without loss include Zip, the RAR, the NCW, the FLAC, the ALAC, the HD-AAC and WMA and video formats like PNG noted.
Wasted compression
In the lossy compression method, the data after compression are different from the original data. There are usually two schemes for wasting compression:
- Loss conversion codecs: Based on these codecs, the received image or audio sample is divided into small sections.
- Lost Predictive Codecs : Previous and next decoded data is used to predict the current audio sample or image frame.
In some systems, these two methods are used in conjunction with conversion codecs to compress the prediction phase error signals. The advantage of the loss-free method over the no-waste method is that in some cases it is able to produce a smaller compressed file than the known non-waste method, while meeting the requirements.
On the other hand, lossless compression schemes have the ability to recover original data; While plans with a loss of data accept part of the data to achieve higher compression. In compression, data loss reaches a point where no re-compression of the file will take place. The most famous lossy compression formats such as MP3, or MP4, or AAC, or WMA and Ogg and video formats like JPEG noted.
Hoffman encoding method for data compression
Compression history
In 1949, Claude Shannon and Robert Fano invented Shannon-Fano coding to assign code based on block probabilities. This method is only optimal in variable length cryptographies. In 1951, David Hoffman invented an optimal method that used a regular frequency binary tree that was more efficient than Shannon Fano coding.
In 1977, Abraham Lampel and Jacob Zio developed the LZ77 and LZ78 algorithms. These algorithms quickly became popular. Some current algorithms such as DEFLATE, LZMA and LZX are derived from LZ77. Because of the LZ78 patent issue in 1984, Unix developers adapted game text algorithms such as DEFLATE-based gzip and Burroughs-Wheeler-based BZip2 formats designed to achieve a higher compression ratio than the LZ78.
Here are five common types of compression offered by SyncBackFree, SyncBackSE, and SyncBackPro backup software:
Conventional compression algorithm in SyncBackFree
DELFATE
Invented in 1993 by Phil Katz. The most modern types of compression are based on this method. This method uses LZ77 with Hoffman coding. Compression results are obtained in a short time.
Compression methods in SyncBackSE
DEFLATE64
This method offers better performance and compression rate than DEFLATE. This method is known as DEFLATE Improved.
Burroughs Wheeler Converter (BWT)
This method uses a reversible conversion to find duplicate patterns in the data and rearrange them. By rearranging the data, BWT can optimally encrypt the data, leading to higher compression rates.
Types of compression in SyncBackPro
BZip2
Burroughs Wheeler converter type text that uses simple principles to achieve the right balance between speed and compression ratio. This format is very popular in Unix environments and uses a variety of techniques to generate output. BZip2 can be slow in some instances, such as controlling highly random data.
LZMA
The Lampel-Zio-Markov chain algorithm was first introduced in .7z file format with the release of 7-Zip archive software in 1998. LZMA in most samples is able to achieve higher compression than BZip2, DEFLATE and other algorithms; While using the same speed and memory. Similar to BZip2, a series of compression methods are used to achieve the result.
Practical examples
After getting acquainted with the concepts of file compression theory, it is necessary to get acquainted with it in practice and application. Simply put, compression reduces file size but does not compromise file performance. A practical example are zip files. When you open a zip file, Windows automatically decompresses it and compresses it again when you close it.
Do I have to compress an entire hard drive?
With compression, files take up less disk space, but the processor spends more time on compressed files; This is because it has to be decompressed and re-compressed each time it is used. Since most current computers have a lot of disk space, normal compression is not recommended; Because of the high CPU consumption, the work process is slow; But if you use some files infrequently, it is better to keep them compressed.
How to compress files and folders in Windows
Explorer and command line can be used to compress files and folders in Windows. By compressing a file, only that file is compressed; But by compressing a folder or even a partition, you can simply compress that folder or apply compression rules to subfolders and all the files in it. As shown below, compressing a folder using Explorer gives you two options:
Apply Changes to this folder only
Apply changes to this folder, subfolders and files
The first option to apply changes to a folder is to assign the compression attribute only to new files. As a result, not every file in the folder is compressed; But new files that will be added to the folder in the future will be compressed. This also applies to new subfolders.
The second option (Apply changes to this folder, subfolders and files) works as its name implies. All files in the current folder are compressed as well as all the files in each subfolder. The compression attribute will also be applied to new files.
When compressing drive C or any of the other drives, you will have similar options for compressing folders; But the steps are a little different. open the drive properties in Explorer and enable the Compress this drive option to save disk space.
You will then have the option to apply compression to the root of the drive or all of its subfolders and files. You do not need any other tools or software to compress a file or folder in Windows 10, and you can use the default Windows tool to compress files and folders.
Follow the steps below to compress the file in Windows:
1. Go to Windows Explorer and click on the file or folder you want to compress.
2. Select the Add to archive option.
3. In the next window, you will see options for selecting the archive format, renaming the file, and the compression method.
4. To extract files from a compressed folder, open the zip folder by double-clicking on it and drag the contents to the new location.
File compression method on Mac
Mac devices typically have the default zip compression and decompression tools. The Mac compression tool uses a no-waste method and does not compromise data and their quality.
1. Go to the Finder section and select the file or folder you want to compress.
۲. Right-click on the file or folder to bring up the pop-up menu, then select the compress option.
3. When it comes to compressing a file, it depends on the type of file, the RAM of the device, and the processor.
4. A new copy of the file will be generated in ZIP format.
If you are looking to decompress a file and display its contents, you must double-click it. The Mac embedded tool automatically decompresses the file and opens it.
Compress files in Linux
Linux and Unix use TAR and gzip as the default file archive format. You need to remember some commands to compress files. Some of the common Linux compression commands are:
tar -czvf name_of_archive.tar.gz / location_of_directory
If you have a folder called dir1 in your current folder and want to save it to a file called dir1.archived.tar.gz, you must run the following command:
tar -czvf dir1archived.tar.gz dir1
File compression limitations
NTFS is the only Windows file system that supports zip files; As a result, partitions formatted with FAT can not be compressed. Some hard drives can be formatted to use clusters larger than the default value of 4 KB. Any filesystem that uses a cluster larger than this default value will not be able to compress.
Compressing some files in Windows becomes problematic; Because they are needed to run Windows. BOOTMGR and NTLDR are two examples of files that should not be compressed. Newer versions of Windows do not allow you to compress these types of files.
More tips on compressing files
Obviously, compressing larger files takes more time. The total compression time depends on the number of files in the folder or hard drive, the size of the files, and the overall speed of the computer. Some files are not compressed well, while others are compressed up to ten percent of the original file size or even less. For example, most ISO files are compressed during creation, so re-compressing them with Windows features will not greatly affect the overall file size. In general, you should pay attention to the following points when compressing files:
- Avoid converting format with loss to format without loss.
- Consecutive compression of a file reduces its quality.
- Some ransomware and antivirus software cannot scan compressed files and folders; This puts your device at risk for security. Before decompressing the file, scan it using the appropriate antivirus and compatible files.
- Errors may occur due to lack of disk space or memory when compressing or decompressing the file.
Conventional compression software
Apart from Windows tools, there are several other tools for compressing files. Each of these softwares supports a different set of archive formats and offers different features; That’s why choosing the best compression software is time consuming. The following is a list of the best compression software:
WinZip
WinZip is one of the most popular file compression software. With this software, you can optimize the compression and sharing of files and decompress the file if necessary. The software has the ability to connect to multiple cloud storage devices such as Google Drive, OneDrive and Dropbox. One of the features of WinSip is ZipSend, which allows you to compress large files and send them as email attachments. WinZip is one of the best file compression software in terms of features and ease of use.
Supported formats : zip, tar, gzip, cab, rar, 7z, IMG, ISO, XZ, VHD, VMDK, lha / lzh
7zip
7zip is one of the most popular open source compression software with high compression rate. If your priority is to minimize file size, 7zip can be an ideal option. This software is free due to the nature of open source. 7zip with AES-256 encryption and useful features such as integrated file management, Windows Shell compatibility, self-extracting capabilities for 7z format and FAR manager plugin are used at the business and business level. One of the advantages of 7-zip over other compression software is that it is free.
Supported formats : 7z, XZ, BZIP2, GZIP, TAR, ZIP, WIM, AR, ARJ, CAB, CHM, CPIO, CramFS, DMG, EXT, FAT, GPT, HFS, IHEX, ISO, LZH, LZMA, MBR, MSI, NSIS, NTFS, QCOW2, RAR, RPM, SquashFS, UDF, UEFI, VDI, VHD, VMDK, WIM, XAR and Z.
WinRAR
WinRAR is another popular compression software. This software is recommended for compressing multimedia files; Because it uses the best compression method for these files. Other compression tools can only extract RAR files; But WinRAR is the creator of RAR files. You can use the solid archive box feature to compress batch files. In addition to 256-bit AES encryption, WinRAR offers the ability to split files into separate sections, repair damaged files, and support long filenames. Of course, the WinRAR interface is a bit annoying for novice users. You will also find annoying pop-ups and ads in the free version.
Supported formats : RAR, CAB, ZIP, UUE, Z, ACE, ARJ, 7-ZIP and TAR
PeaZip
If you deal with ZIP files a lot, PeaZip can be a good option. This software compresses and archives files with maximum ease. PeaZIP supports 150 different formats and features such as encrypted password management, 2-step authentication, duplicate file search, splitting archives into multiple files, and scheduling archives. PeaZip has advanced features for compressing all types of files with limited resources.
Supported formats
- 7z, Google Android apk, bz, bz2, bzip2, tbz2, tbz, gz, gzip, tgz, tpz, tar, zip, zipx, z01, smzip, arj, cab, chm, chi, chq, chw, hxs, hxi, hxr, hxq, hxw, lit, cpio, deb, lzh, lha, rar, r01, 00, rpm, z, taz, tz, iso, pet, pup, pak, pk3, pk4, slp, xpi, wim, u3p, lzma86, lzma, udf, xar, Apple’s dmg, part1, split, swm, tpz, kmz, xz, txz, vhd, mslz, apm, mbr, fat, ntfs, exe, dll, sys, msi, msp, quad, balz , Bcm, zpaq, paq8f, paq8jd, paq8l, paq8o, lpaq1, lpaq5, lpaq8, gnm
- Open Office and LibreOffice formats: ots, odm, oth, oxt, odb, odf, odg, otg, odp, otp, odt, ott
- Microsoft Office formats: doc, dot, xls, xlt, ppt, pps, pot, docx, dotx, xlsx,
- Flash: swf, flv
- Java: war, ear, jar
Zipware
Zipware is a Windows platform compression software. This software supports all major archive formats and easily manages small and large archive files. In Zipware you can create password-protected archive files, perform archiving operations from Windows Explorer, and convert popular archive formats to 7z and Zip. This software allows you to split archive files into different sections. In addition, Zipware has a password manager feature for storing and managing passwords. This software is free.
Supported formats : ZIP, ZIPX, 7Z, RAR, RAR5, ISO, VHD, MSI, GZIP, BZIP2, TAR, CPIO, DEB, DMG, LZH, LZMA, LZMA2, PPMd, NSIS, RPM, UDF, WIM, XAR, XPI, CBR, CBZ, XZ, Z.
Hamster Zip Archiver
If you are looking for software with high ease of use and advanced compression operations, hamster zip archiver is a good choice. This free software supports all known formats, and its drag-and-drop user interface makes file compression easy. Compatibility with cloud services such as Google Drive, Dropbox and Yandex Disk are other features of this software. hamster zip archiver is only available for the Windows platform.
Supported formats : zip, 7z, arj, bz2, tbz, gzip, deb, dmg, img, gz, tgz, hfs, lzh, rmp, pkg, z, taz, cab, iso, rar, tar, wim, swm and jar.
Express Zip File Compression
express zip file compression is the optimal software for file compression. The free version of this software is designed for home and novice users and to perform daily compression tasks such as zipping or unzipping files, compressing files for sending emails, opening compressed files in archival formats such as RAR, TAR, 7Z and CAB. You can use this software to compress and reduce the size of the desired files and share the file with friends and family.
Supported formats: Zip, zipx, rar, tar, tgz, tar.gz, gz, gzip, 7z, cab, iso, img, dmg, arj, jar, bz2, tar.bz2, tar.xz, wim, xz, z, bkz, nco, apk, lzh, pkpass, multi-disk (zip.00x) and multi-disk (7z.001).
Select the best file compression software
When choosing the best software for file compression, you need to consider things like supported formats, operating system and compression ratio. In addition to these compression tools, there are many online tools for compressing or decompressing files and folders; But these tools may not be suitable for sensitive data.