Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Analyse RGB file in Processing
byte bytes[];
int x = 0;
int y = 0;
int maxX = 431;
void setup() {
bytes = loadBytes("zaagsel-1000000bytes.rgb");
size(500, 1000);
}
void draw() {
background(0);
x=0;
y=0;
for (int i=0; i<bytes.length-3; ) {
char r = char(bytes[i++] & 255);
char g = char(bytes[i++] & 255);
char b = char(bytes[i++] & 255);
set(x, y, color(r, g, b));
if (++x>maxX) {
x=0;
y++;
}
}
}
void mouseMoved() {
maxX = mouseX;
}
void keyPressed() {
if (keyCode==LEFT) maxX--;
if (keyCode==RIGHT) maxX++;
if (key==' ') println(maxX);
}
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.