function info = iminfo(x); % Another Way of Obtaining Information About Image x = double(x); % uint8 to double Conversion if size(x, 3) == 3, typ = 'color'; else typ = 'bw'; end mx = max(x(:)); [row, col, d] = size(x); R = ceil(log2(mx))*d; L = 2^R; s = row*col*R*d; if nargout == 0, disp(' '); disp([' Image Type = ', typ]); disp([' Image Dimension = ', num2str(row), ' x ', num2str(col)]); disp([' R = ', num2str(R), ' bits/pixel']); disp([' L = ', num2str(L), ' colors']); disp([' Image Size = ', num2str(s),' bits']); disp([' = ', num2str(s/8),' bytes']); disp([' = ', num2str(s/8/1024),' kbytes']); else info = struct('row', row, 'col', col, 'R', R, 'L', L, 'size', s, 'type', typ); end