What is the difference between lossy and lossless compression?
We often divide image compression into two categories – lossy and lossless compression.
Lossy compression reduces file size by permanently eliminating certain information. Specifically, it eliminates redundant information, even though the user may not notice it. For example, JPEG is a format that uses lossy compression.
However, lossless compression retains raster values during compression. At the same time, it still ma ages to reduce file size. For example, LZ77 is a lossless compression file type.
Let’s compare both image compression methods and their potential uses in GIS.
When should you use lossy and lossless compression?
In GIS, lossy compression data is good for basemap imagery because it has faster loading speeds with lower compression ratios. You should not choose lossy compression if you want to perform further analysis of the data.
Lossy compression algorithms often result in greater reductions in file size. It’s often the case that the human eye cannot distinguish between lossless and lossy compression. Lossy image compression offers the best compression ratios with good enough approximations.
On the other hand, lossless compression reduces file size but retains redundant information after compression. For example, LZ77 is a type of lossless compression.
Lossless compression is good if there will be a new analysis of the data. This is because it doesn’t alter any of the original values. This means that it’s good for discrete data or any raster image that already has lossy compression.
READ MORE: Image Compression and Encoding for Raster Data
JPEG stands for Joint Photographic Experts Group, which is the group that created the standard. It has an extension of JPG and JPEG and is the most common image format used by digital cameras and on the World Wide Web.
It’s a lossy compression type for digital images. Lossy image compression reduces file size and eliminates redundant information. The user decides how much loss to introduce with a trade-off in storage size and quality.
For example, the compression quality ranges from 1 to 100. A lower value compresses the raster image but also reduces the quality.
JPEG 2000 (JP2) is the newest version of JPEG. It slightly improves image compression performance over JPEG using two different wavelet transforms. Users can choose low to high levels of compression.
LZ77 compression is a lossless image compression meaning it maintains raster values during compression.
Abraham Lempel and Jacob Ziv introduced this format in 1977 and we still use it today. Combining the first letter from both last names (LZ) and the year it was invented (1977), this is how the acronym (LZ77) was created.
It uses the same commission algorithm as PNG (Portable network graphic). Also, it’s the default raster GIS compression that ArcGIS uses.
The theory behind LZ77 image compression is that repeat values in a raster image are stored according to their position and length. Instead of storing single values for each cell, LZ77 simply stores where the value was found and how long the string of values is.
MrSID vs ECW
JPEG 2000 can achieve a compression ratio of 20:1 which is similar to MrSID and ECW format.
We commonly use LizardTech’s proprietary MrSID (Multiresolution Seamless Image Database) for orthoimages and base maps. MrSID images have an extension of SID and are accompanied by a world file with the file extension SDW.
The MrSID file format has impressive compression ratios. Color images can be compressed at a ratio of over 20:1. LizardTech’s GeoExpress is a software package capable of reading and writing MrSID format.
ECW (Enhanced Commission Wavelet) is a compressed image format typically for aerial and satellite imagery. This GIS file type is known for its high-compression ratios while still maintaining quality contrast in images.
ECW format was developed by ER Mapper, but it’s now owned by Hexagon Geospatial.
READ MORE: The Ultimate List of GIS Formats – Geospatial File Extensions
Lossless Compression vs Lossy Compression
Lossless compression retains values and manages to lower file size.
However, lossy compression reduces file size by eliminating redundant information.
While LZ77 is an example of lossless compression, JPEG is an example of lossy compression.
Depending on your intended uses, you have to choose lossy or lossless compression appropriately.
The Ultimate List of GIS Formats and Geospatial File Extensions
5 Free Historical Imagery Viewers to Leap Back in the Past
How to Download USGS Topo Maps for Free
15 Free Satellite Imagery Data Sources
What is Geodata? A Guide to Geospatial Data
25 Satellite Maps To See Earth in New Ways
5 Free Global DEM Data Sources – Digital Elevation Models
Top 6 Free LiDAR Data Sources