MATLAB: Open jpeg, png and bmp only

bmpimage compressionjpegonly filepng

hi .. i'm making a GUI image with JPEG compression. and I want to limit the system with input image is jpeg, png and bmp only. how should I do?

Best Answer

Adapting Image Analyst's suggestion:
if ismember(ext, {'.png', '.bmp', '.jpg', '.jpeg'})
% It's an allowed extension
else
message = 'Only PNG, BMP, JPG, or JPEG format images are allowed.';
uiwait(warndlg(message));
end
And remember to add .jpg and .jpeg to the uigetfile call.