%% Display Animated GIF With Letterboxing
% Create an image component that displays an animated GIF using the actual size of the image.

f = uifigure;
im = uiimage(f,'ImageSource','questions.gif');
im.ScaleMethod = 'none';

%
% Now, scale the image so that it fits within the default component area, preserving aspect ratio and without clipping. Then, apply a black background to create the appearance of letterboxing (black bars above and below the image).
%

im.ScaleMethod = 'scaledown';
im.BackgroundColor = 'black';

%
%
% Copyright 2018 The MathWorks, Inc.