Automatically Maximize an Image in MATLAB


MATLAB programming allows us to automatically maximize an image for better visibility. For this, we can use the “figure” function with some arguments which described in the following syntax.

Syntax

figure('units', 'normalized', 'outerposition', [0 0 1 1]);

The “figure” command with all these parameters automatically maximizes an image.

The following MATLAB program demonstrates the implementation of a code to automatically maximize an image.

MATLAB Program Example

% MATLAB program for automatically maximize an image
% Read the input image
img = imread('https://www.tutorialspoint.com/assets/questions/media/
14304-1687425236.jpg'); % Replace 'your_image.jpg' with the path to your image
% Display the original image in a figure window
figure, imshow(img); title('Original Image');
% Display the maximized image in another figure window
figure('units', 'normalized', 'outerposition', [0 0 1 1]), imshow(img); title('Maximized Image');

Output

The normal image is:

The maximized image is:

Conclusion

In the above MATLAB program, we read the input image by using the “imread” function and stores it in the variable “img”. Then, we display the input image as it is by using the “imshow” function in a figure window by using the “figure” command with a title “Original Image”. Next, we display the same image by using the “imshow” function, but this time we specified some parameters in the “figure” option the automatically maximizes the image to fit the figure window. A title “Maximized Image” is also assigned to this image.

Updated on: 18-Jul-2023

65 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements