function out = imglinear(file,p)
%file must be square
%same as "imgjpeg" but with Linear quantization matrix
%Some parts of code obtained from
%http://math.gmu.edu/~tsauer/class/447/proj/chap11.pdf


Q = p* [8 16 24 32 40 48 56 64     %Linear Quantiziation matrix
    16 24 32 40 48 56 64 72
    24 32 40 48 56 64 72 80
    32 40 48 56 64 72 80 88
    40 48 56 64 72 80 88 96
    48 56 64 72 80 88 96 104
    56 64 72 80 88 96 104 112
    64 72 80 88 96 104 112 120]

X = imread(file);       % assign the image to X

X = double(X);          % convert to double
r = X(:,:,1);
g = X(:,:,2);
b = X(:,:,3);

X = 0.216*r + 0.7152*g + 0.0722*b;   %converts to grey

[m,n] = size(X);                     %creates sublist to perform loops

for i = 1:8:m
    for j = 1:8:n

        block = X(i:i+7,j:j+7);     % take 8x8 block
        comp = imagecomp(block,Q);  % compress the block
        X(i:i+7,j:j+7) = comp;      % insert the block back in

    end
end

% show the newly compressed image
figure
imagesc(uint8(X)); colormap(gray)

title(['P = ', num2str(p)])

out = X;
Not enough input arguments.

Error in imglinear (line 8)
Q = p* [8 16 24 32 40 48 56 64     %Linear Quantiziation matrix