Problem #4


I compressed the image santosa.jpg using MATLAB's imwrite function. We can specify the quality as a number between 0 and 100. For example, we first read the image with the command:
A=imread('santosa.jpg');
Then we can compress the image in matrix A with quality, say, 10 and save it as santosa10_4.jpg using:
imwrite(A,'santosa10_4.jpg','jpeg','quality',10);

Notice as the quality goes down, the file size (in bytes) gets smaller and the image become less recognizable. We can approximate the compression ratio by dividing the original image's file size by the compressed image's file size. A compression factor of size x indicates the compression ratio is x:1.


Original Image
Quality=100
Size=15220

Quality=80
Size=5943
Compression Factor 2.56

Quality=50
Size=4515
Compression Factor 3.37

Quality=10
Size=1776
Compression Factor 8.57

Quality=5
Size=1370
Compression Factor 11.11

Quality=1
Size=1158
Compression Factor 13.14

Back to HW 1 Page.