Skip to content

Instantly share code, notes, and snippets.

@benfarahmand
Last active December 11, 2015 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save benfarahmand/4626641 to your computer and use it in GitHub Desktop.
Save benfarahmand/4626641 to your computer and use it in GitHub Desktop.
Image Modifier for tuvalabs, using processing
//image modifier will make images all the same size
PImage[] tempImages;
String rootDir = "C:/Users/Ben/Dropbox/TuvaLabs UI-UX Design/Mock-ups/Assets/Images for Personalization Page/";
ArrayList directories, names; //holds the directories for all image files to be modified
void setup(){
size(200,150);
directories = new ArrayList();
names = new ArrayList();
File file = new File(rootDir);
for(int i = 0 ; i < file.list().length ; i++){
File subFile = new File(rootDir + file.list()[i] + "/");
for(int j = 0 ; j < subFile.list().length ; j++){
directories.add(rootDir + file.list()[i] + "/" + subFile.list()[j]);
names.add("c_" + file.list()[i] + "_" + subFile.list()[j]);
}
}
tempImages = new PImage[directories.size()];
for(int i = 0 ; i < tempImages.length ; i++){
tempImages[i] = loadImage((String) directories.get(i));
image(tempImages[i],0,0,width,height);
save(((String)names.get(i)).replace(' ','_').toLowerCase());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment