Skip to content

Instantly share code, notes, and snippets.

@jnkather
Created October 15, 2015 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnkather/1b3f6f292c0e0ccbb06c to your computer and use it in GitHub Desktop.
Save jnkather/1b3f6f292c0e0ccbb06c to your computer and use it in GitHub Desktop.
create thumbnails of large images using Matlab blockproc and parallel processing
IMpath = 'C:\folder\input\'; % specify input/output folder
allImgs = {'filename1.tif',...
'filename2.tif'}; % specify filenames
% iterate through all images
for i=1:numel(allImgs)
fun = @(block_struct) imresize(block_struct.data,0.1);
imgOut = blockproc([IMpath,char(allImgs{i})],...
[1000 1000],fun,...
'UseParallel',true,...
'PadPartialBlocks',false);
imwrite(imgOut,[IMpath,char(allImgs{i}),'-THUMB10.tif']);
clear imgOut
disp('DONE image');
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment