Created
July 3, 2014 03:24
-
-
Save ynaoto/957f5eb045f21f154e42 to your computer and use it in GitHub Desktop.
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
background(255, 0, 0); | |
PImage img = loadImage("179033_486608097723_1903922_n.jpg"); | |
img.loadPixels(); | |
int n = img.width * img.height; | |
for (int i = 0; i < n; i++) { | |
color c = img.pixels[i]; | |
float a = alpha(c); | |
float r = red(c); | |
float g = green(c); | |
float b = blue(c); | |
a = max(r, g, b); | |
img.pixels[i] = color(r, g, b, a); | |
} | |
img.updatePixels(); | |
image(img, 0, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment