function [img] = solution_hw6_p4a(f, p)
% Given an image file f return the compressed approximation
%   f - File name of the image
%   p - Rank to reduce to
%   img - Reduced image

    img = imread(f); % Read the image
    img = double(img); % Convert to a double
    
    [~, ~, c] = size(img); % Get the size of the image
    
    for i=1:c % Iterate over the colors
        img(:,:,i) = solution_hw6_p3(img(:,:,i), p);
    end

    img = uint8(img);

end

