i_min = 167; j_min = 391; i_max = 933; j_max = 1524; repo = 'screenshots'; shots = dir(repo); for i = 1:length(shots) i if (strcmp(shots(i).name, '.') || strcmp(shots(i).name, '..')) continue end im = imread(strcat(repo, '/', shots(i).name)); imwrite(im(i_min:i_max,j_min:j_max,:), strcat('/home/thomas/stage/rapport/rapport/img/new/', shots(i).name)) ; end