Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This sketch pulls out messages hidden by the Static-Cipher.pde.
void setup() {
size(600,600);
PImage Garbled = loadImage("Message.png");
PImage Message = createImage(width,height,ARGB);
Garbled.loadPixels();
for (int x = 0; x<width;x++) {
for (int y = 0; y <height; y++) {
int loc = x + y*width;
float r = red(Garbled.pixels[loc]);
float g = green(Garbled.pixels[loc]);
float b = blue(Garbled.pixels[loc]);
if((r==100) && (g==100) && (b==100)) {
Message.pixels[loc] = color(0);
} else {
Message.pixels[loc] = color(255);
}
}
}
Message.updatePixels();
image(Message,0,0);
}
void draw() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.