Skip to content

Instantly share code, notes, and snippets.

@jpatel3
Forked from benfarahmand/Image Modifier
Created January 24, 2013 20:06
Show Gist options
  • Save jpatel3/4627147 to your computer and use it in GitHub Desktop.
Save jpatel3/4627147 to your computer and use it in GitHub Desktop.
//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));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment