
%Black and White
bw = zeros(512,512,3, 'uint8');
bw(:,:,:) = 255;
step = 255

for i = 1:32:512
    for j = 1:32:512
        bw(i:i+30,j:j+30,:) = step;
        step = step - 1;
    end
end

imwrite(bw, 'bw.bmp');


%Red
red = zeros(512,512,3, 'uint8');
red(:,:,:) = 255;
step = 255

for i = 1:32:512
    for j = 1:32:512
        red(i:i+30,j:j+30,1) = step;
	  red(i:i+30,j:j+30,2) = 0;
	  red(i:i+30,j:j+30,3) = 0;
        step = step - 1;
    end
end

imwrite(red, 'red.bmp');


%Green
green = zeros(512,512,3, 'uint8');
green(:,:,:) = 255;
step = 255

for i = 1:32:512
    for j = 1:32:512
        green(i:i+30,j:j+30,1) = 0;
	  green(i:i+30,j:j+30,2) = step;
	  green(i:i+30,j:j+30,3) = 0;
        step = step - 1;
    end
end

imwrite(green, 'green.bmp');



%Blue
blue = zeros(512,512,3, 'uint8');
blue(:,:,:) = 255;
step = 255

for i = 1:32:512
    for j = 1:32:512
        blue(i:i+30,j:j+30,1) = 0;
	  blue(i:i+30,j:j+30,2) = 0;
	  blue(i:i+30,j:j+30,3) = step;
        step = step - 1;
    end
end

imwrite(blue, 'blue.bmp');



%Yellow
yellow = zeros(512,512,3, 'uint8');
yellow(:,:,:) = 255;
step = 255

for i = 1:32:512
    for j = 1:32:512
        yellow(i:i+30,j:j+30,1) = step;
	  yellow(i:i+30,j:j+30,2) = step;
	  yellow(i:i+30,j:j+30,3) = 0;
        step = step - 1;
    end
end

imwrite(yellow, 'yellow.bmp');



%Magenta
magenta = zeros(512,512,3, 'uint8');
magenta(:,:,:) = 255;
step = 255

for i = 1:32:512
    for j = 1:32:512
        magenta(i:i+30,j:j+30,1) = step;
	  magenta(i:i+30,j:j+30,2) = 0;
	  magenta(i:i+30,j:j+30,3) = step;
        step = step - 1;
    end
end

imwrite(magenta, 'magenta.bmp');



%Cyan
cyan = zeros(512,512,3, 'uint8');
cyan(:,:,:) = 255;
step = 255

for i = 1:32:512
    for j = 1:32:512
        cyan(i:i+30,j:j+30,1) = 0;
	    cyan(i:i+30,j:j+30,2) = step;
	    cyan(i:i+30,j:j+30,3) = step;
        step = step - 1;
    end
end

imwrite(cyan, 'cyan.bmp');