close all
A=imread('nash.jpg');
A=im2double(A);
A=rgb2gray(A);
[m, n]=size(A);
figure,imshow(A)

k=100;
[U,Sigma,V]=svd(A);
Uk=U(:,1:k);
Sigmak=Sigma(1:k,1:k);
Vk=V(:,1:k);
Ak=Uk*Sigmak*Vk';
figure,imshow(Ak)
pixels_saved=m*n-(n+m+1)*k
imwrite(I,'compressed_nash.JPG')
