Skip to content

Instantly share code, notes, and snippets.

@gifguide2code
Created May 13, 2018 03:31
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 gifguide2code/9e433da0d4adead40005eb6108c18e23 to your computer and use it in GitHub Desktop.
Save gifguide2code/9e433da0d4adead40005eb6108c18e23 to your computer and use it in GitHub Desktop.
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