clear all; close all; clc;

img = imread('.\Test Images\Mackay-GoodOptics.tif');
img2 = zeros( size(img) );

img2(:,:,1) = max(img,[], 3);
img2(:,:,2) = img2(:,:,1);
img2(:,:,3) = img2(:,:,1);
img2 = uint8(img2);
imshow(img2)
imwrite(img2, '.\Test Images\Mackay-GoodOptics_ori.tif','tif' );