MATLAB: How to convert tiff image into gray image

image processingImage Processing Toolbox

how to convert tiff image into gray image? I tried rgb2gray but it show me an error about "RGB must be a m x n x 3 array" my tiff image is (m x n x 4)

Best Answer

Your image has a transparency channel in addition to the three colour channels. If you don't want to do anything with the transparency information, just discard it:
img(:,:,4) = [];
%proceed with rgb2gray