is compression used to reduce the file size?

9 views (last 30 days)
please can someone explain me what is compression... is it means reducing size of an image.... i got a code for image compression.... but my input image size is 256*256 and the compressed image size is also 256*256.... i'm totally confused... i read few topics related to compression.... but i'm not clear about that.... please can someone spare few time to explain me....

Accepted Answer

ES
ES on 25 Apr 2014
Every Image file has lots of redundant data. Transformation algorithms reduce the redundancies in the image data there by reducing file size of the image. Where as the resolution is (your 256X256 etc) does not change with image compression.
  3 Comments
ES
ES on 25 Apr 2014
Edited: ES on 25 Apr 2014
File Format is a complicated subject. There are coding techniques for each file format. for example, a teacher teaches in the class. Each student takes notes. Some use shorthands and symbols. Some use other symbols, some write the whole dictation. So the size of their notes varies. Similarly, depending on the symbols(codes) each format uses, the size of the files also vary.
Now coming to compression, There are two types of compression. Lossy Compression: where when you compress, some data is lost. When uncompressed, though the image looks same as the original image, there is some definitive loss. When you save a raw image(from camera) and save it as jpg, a lossy compression takes place. The original image cannot be retrieved from a lossy compressed image.
Lossless Compression: There are other complex compression techniques which are lossless. They reduce the file size of the image. But every bit of data is preserved. Here from the compressed file, the original can be retrieved.

Sign in to comment.

More Answers (2)

Walter Roberson
Walter Roberson on 25 Apr 2014
Several students lately have been working with DCT or DWT, arriving at a matrix of coefficients that is the same size as the original, and then asking what the compression ratio is.
DCT and DWT themselves do not compress. What they do is find a way to describe images so that the last coefficients are describing finer and finer detail that a human would often overlook. If you keep only the beginning coefficients and discard the ending coefficients for a block, you have kept most of the information about how the block looks, and since you are not keeping all of the information you do not need as much space to store what you kept. Then when it is time to rebuild, the coefficients that were discarded are filled in with 0 and the block is rebuilt from that matrix, an action which produces an output block that differs only slightly from the original image block. The fewer coefficients you discarded, the more accurate the reconstruction but the lower the compression ratio. The more coefficients you discard, the less accurate the reconstruction but the higher the compression ratio.

Image Analyst
Image Analyst on 25 Apr 2014
You need to look at how many bytes are used to store the 256*256 pixels on disk . When you read it back in , it will undo any compression what was applied and you will end up back with the same resolution that you started with , though perhaps with some intensity changes depending on how lossy the compression was.

Categories

Find more on Denoising and Compression in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!