Created
June 2, 2016 15:02
-
-
Save jacobjoaquin/5c422ac09b9b4b11c6f99047b2bf1621 to your computer and use it in GitHub Desktop.
Cycles the Hue of Andy Warhol's Marilyn Monroe Screen Print
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
PImage img; | |
int hueOffset = 0; | |
void setup() { | |
img = loadImage("warholMarilyn.jpg"); | |
surface.setSize(img.width, img.height); | |
colorMode(HSB); | |
} | |
void draw() { | |
loadPixels(); | |
for (int i = 0; i < pixels.length; i++) { | |
int h = ((int) hue(img.pixels[i]) + hueOffset) % 256; | |
pixels[i] = color(h, saturation(img.pixels[i]), brightness(img.pixels[i])); | |
} | |
updatePixels(); | |
hueOffset = (hueOffset + 1) % 256; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment