• fullscreen
  • picture_moding_hw_2_1_12.pde
  • PImage img;
    int pointillize = 16;
    
    void setup() {
      size(1280,888);
      img = loadImage("fish.jpeg");
      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);
    }
    

    code

    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.

    license

    advertisement

    Joshua Moody

    CuttleFish

    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    find the fish

    You need to login/register to comment.