Image cropping across multiple files

A
Addilynn · Sep 26, 2020 · 2K views
Question
There are 4 images, and I want to crop them by using coding. But I want to crop one image by using imcrop command and other 3 images should automatically cropped the same place i cropped the image 1. As an example there are 1.bmp, 2.bmp, 3.bmp, 4.bmp, I want to give cropping parameters to only 1.bmp image and other images will be cropped the same place and view the crop images in a fig format.
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 24, 2026
You ought to be able to accomplish this with imcrop itself.
First use this:
 [I1c rect] = imcrop(I1)
Which returns the cropping rectangle in rect, a four-element position vector.
Then
 I2c = imcrop(I2, rect)

Which crops the image I2. rect is a four-element position vector[xmin ymin width height] that specifies the size and position of the crop rectangle obtained from the first image.

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!