from Compression Ratio by Madhu S. Nair
Get the compression ratio

assign1.m
% % Program No:1
% Matlab functions for the following
% a)Read an image
% b)Copy the image to another file
% c)Get the image information
% d)Find the compression ratio for the copied image

f=imread('crystal.jpg');
imwrite(f,'crystal1.jpg');
k=imfinfo('crystal.jpg');
ib=k.Width*k.Height*k.BitDepth/8;
cb=k.FileSize;
cr=ib/cb

Contact us at files@mathworks.com