Runlength encoding is a lossless compression algorithm.
Play with the simulator above.
See what happends when you enter this string:
aaaaaaaaaaaaaaabbbbbbbaaaaaaaaaaaaaaaabbaaaaaaaaaaaaaaaaaaaaaabbbbbbbbaaaaaaaaaaaaaaa
Images can take up a lot of storage space.
And have you ever experienced loading a webpage and waiting for an image to appear (download)?
One thing we can do before storing or transferring images is compress them.
JPEG is a very popular compression algorithm.
It removes non-essential data from an image.
WARNING! JPEG is a lossy compression algorithm. The original file will not be restored after compression takes place.
Do some research.
Find out what you can about transform coding.
How does it work and how does it differ fron runlength encoding?
Some problems are really hard to find an optimal solution. Text compression falls into this category. We are forced to follow a heuristic approach to solving the problem, doing the best we can and hoping that we can improve it given time.
Compressing digital data comes in two forms: lossy and lossless compression.
lossy compression means that some of the data will be gone forever when compression happens. This might mean a reduction in quality of the data, for example an image might look pixelated and blurry after compression. However, it is still possible to use lossy compression without too much loss of quality, as we will see later.
The other form of compression is lossless compression. This is when data is compressed and can be decompressed to recreate the original data perfectly. The text compression methods we looked at in this unit are an example of lossless compression.
compress data decompress lossy file lossless key algorithm heuristic approach