Skip to content

Instantly share code, notes, and snippets.

@wonderburg7
Last active November 22, 2018 20:07
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 wonderburg7/9d3f5c4e0a368146da3b5771088802a4 to your computer and use it in GitHub Desktop.
Save wonderburg7/9d3f5c4e0a368146da3b5771088802a4 to your computer and use it in GitHub Desktop.
PImage img, img1, img2, img3, img4; // Declare a variable of type PImage
int bigdistance = 2000;
int distance = 100;
int gridpoints = (bigdistance/distance);
int picheight = 210,picwidth = 210;
String string1 = "channeler";
int numberofcharacters = string1.length();
int x = picwidth;
int y = picwidth;
static final color BG = -32;
void setup() {
size(4000,1000, JAVA2D);
imageMode(CENTER);
noLoop();
}
void draw() {
background(BG);
for (int j = 0; j < numberofcharacters; j++){
pushMatrix();
string1.charAt(j);
img = loadImage(string1.charAt(j)+"i.png");
img.resize(picheight,picwidth);
translate(x,y);
if (((j-1) % 2) == 0){
rotate(radians(180));
}
image(img,0,0);
x += distance;
popMatrix();
/*saveTransparentCanvas(BG, "umimg");*/
}
//PImage text = get(0,0,((picwidth*numberofcharacters)),(picwidth*2));
// text.save("text.png");
saveTransparentCanvas(BG, "img");
print("Done");
}
void saveTransparentCanvas(final color bg, final String name) {
final PImage canvas = get(0,0,int((picwidth*numberofcharacters)*0.75),(picwidth*2));
canvas.format = ARGB;
final color p[] = canvas.pixels, bgt = bg & ~#000000;
for (int i = 0; i != p.length; ++i) if (p[i] == bg) p[i] = bgt;
canvas.updatePixels();
canvas.save(string1+".png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment