PImage img;
int pointillize = 5;//你油画画笔大小,可以随意调节查看效果
void setup() {
size(450,330);
img = loadImage( "XXX.jpg");
//xxx表示你要艺术化的图片,点击Sketch中的show sketch folder找到你当前文件的文件夹,然后把你要艺术化的图片丢过去。
background(0);
smooth();
}
void draw() {
// Pick a random point
int x = int(random(img.width));
int y = int(random(img.height));
int loc = x + y*img.width;
// Look up the RGB color in the source image
loadPixels();
float r = red(img.pixels[loc]);
float g = green(img.pixels[loc]);
float b = blue(img.pixels[loc]);
noStroke();
// Draw an ellipse at that location with that color
fill(r,g,b,100);
ellipse(x,y,pointillize,pointillize);
}
int pointillize = 5;//你油画画笔大小,可以随意调节查看效果
void setup() {
size(450,330);
img = loadImage( "XXX.jpg");
//xxx表示你要艺术化的图片,点击Sketch中的show sketch folder找到你当前文件的文件夹,然后把你要艺术化的图片丢过去。
background(0);
smooth();
}
void draw() {
// Pick a random point
int x = int(random(img.width));
int y = int(random(img.height));
int loc = x + y*img.width;
// Look up the RGB color in the source image
loadPixels();
float r = red(img.pixels[loc]);
float g = green(img.pixels[loc]);
float b = blue(img.pixels[loc]);
noStroke();
// Draw an ellipse at that location with that color
fill(r,g,b,100);
ellipse(x,y,pointillize,pointillize);
}