Skip to content

Instantly share code, notes, and snippets.

@takuma7
Created January 21, 2013 06:27
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 takuma7/4584000 to your computer and use it in GitHub Desktop.
Save takuma7/4584000 to your computer and use it in GitHub Desktop.
PImage markers = loadImage("AllBchThinMarkers.png");
int w = 12, h = 12;
int w_m = 8, h_m = 8;
int r_num = 64;
int c_num = 64;
int id = 0;
for (int ky = 0; ky < c_num * h; ky += h) {
for (int kx = 0; kx < r_num * w; kx += w) {
PImage marker = createImage(w_m, h_m, RGB);
for (int y = ky + h - h_m, _y = 0; y < ky + h; y++, _y++) {
for (int x = kx + w - w_m, _x = 0; x < kx + w; x++, _x++) {
int pos = y*markers.width + x;
int _pos = _y*w_m + _x;
marker.pixels[_pos] = markers.pixels[pos];
}
}
marker.save("AR_marker_" + nf(id, 4) + ".png");
id++;
}
}
println("done!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment