Last active
May 13, 2018 03:34
-
-
Save gifguide2code/33c826f64f72f42223af710d96be8ccf to your computer and use it in GitHub Desktop.
This sketch hides messages in images of static.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
size(600,600); | |
int step = 2; | |
int imgx = 0; | |
int imgy = 0; | |
int rand = 0; | |
PImage Poltergeist = loadImage("Poltergeist.png"); | |
PImage Img = createImage(width,height,ARGB); | |
Poltergeist.loadPixels(); | |
for (int x = 0; x<width;x++) { | |
for (int y = 0; y <height/step; y++) { | |
int loc = x + y*width; | |
rand = int(random(0,255)); | |
int imgloc = imgx + imgy * width; | |
Img.pixels[imgloc] = color(rand); | |
imgy = imgy + step; | |
} | |
imgy = 0; | |
imgx = imgx + 1; | |
} | |
print(str(imgx)); | |
for (int x = 0; x <width; x++) { | |
for (int y = 0; y < height/step; y++) { | |
int loc = x+y*width; | |
float r = red(Poltergeist.pixels[loc]); | |
float g = green(Poltergeist.pixels[loc]); | |
float b = blue(Poltergeist.pixels[loc]); | |
if ((r==255) && (g==255) && (b==255)) { | |
//Randomize the r, g, b values | |
rand = int(random(0,255)); | |
r = rand; | |
g = rand; | |
b = rand; | |
} | |
int imgloc = imgx + imgy * width; | |
Img.pixels[imgloc] = color(r,g,b); | |
imgy = imgy + step; | |
} | |
imgy = 0; | |
imgx = imgx + 1; | |
} | |
Img.updatePixels(); | |
image(Img, 0,0); | |
save("Message.png"); | |
} | |
void draw() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment