Skip to content

Instantly share code, notes, and snippets.

@saiberz
Created August 27, 2014 08:30
Show Gist options
  • Save saiberz/2d03f0f8b51cb065846e to your computer and use it in GitHub Desktop.
Save saiberz/2d03f0f8b51cb065846e to your computer and use it in GitHub Desktop.
Get id and link from "id_location.jpg" files and resize in two folders
mkdir 'fotos300'
mkdir 'fotos450'
list = dir('*.jpg');
[n ~] = size(list);
ids = [];
locs = [];
for i=0:(n-1)
file = char(list(i+1).name);
foto = imread(file);
file = file(1:end-4);
namefile = strsplit(file,'_');
id = namefile(1);
loc = namefile(2);
ids = [ids id];
locs = [locs loc];
new1 = imresize(foto, [300, 300]);
new2 = imresize(foto, [450, 450]);
name1 = strcat(id,'.jpg');
name1 = char(name1);
imwrite(new1, strcat('fotos300/',name1) ,'jpg');
imwrite(new2, strcat('fotos450/',name1) ,'jpg');
end
T = table(ids',locs')
writetable(T,'id-link.csv','delimiter','\t')
@saiberz
Copy link
Author

saiberz commented Aug 27, 2014

Ejecutar en la carpeta donde estan las fotos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment