Resize the images without deforming them

E
Ernest · Oct 30, 2020 · 1.9K views
Question
I want to know how to resize  images 200 x 200 to 100 x 100 without deforming the images in this code close all; clc; %% Initalize the data dataDir= fullfile('Data/'); exts = {'.jpg','.png','.tif','BMP'}; imds = imageDatastore(fullfile(dataDir),... 'IncludeSubfolders',true,'FileExtensions','.jpg','LabelSource','foldernames'); countEachLabel(imds); [TrainData, TestData] = splitEachLabel(imds, 0.5); size(TrainData); countEachLabel(TrainData); numImages = numel(TrainData.Files); for i = 1:numImages img = readimage(TrainData, i); % img2= imshow(img, 'InitialMagnification', 800); img3= imresize(img, [100 100]); img4= imshow(img3, 'InitialMagnification', 800); drawnow; Train{i} = (img3); %#ok end
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Nov 20, 2025
you're trying to resize 200x200 to 100x100 images.
 
scale = 0.5;
J = imresize(I,scale); % using scale rather than your final output image didn't work as well?
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!