<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with createimage() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=createimage%28%29</link>
      <pubDate>Sun, 08 Aug 2021 19:54:43 +0000</pubDate>
         <description>Tagged with createimage() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedcreateimage%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>images in p2d</title>
      <link>https://forum.processing.org/two/discussion/25795/images-in-p2d</link>
      <pubDate>Wed, 03 Jan 2018 06:22:16 +0000</pubDate>
      <dc:creator>kellen</dc:creator>
      <guid isPermaLink="false">25795@/two/discussions</guid>
      <description><![CDATA[<p>So I'm making a game and it is starting to get very laggy. I switched the renderer to P2D and the frame rate has doubled so that's good. The only problem is that now I can't see the image I was using for a background, and the points I was using as stars are very hard to see.</p>
]]></description>
   </item>
   <item>
      <title>filtering is bugging</title>
      <link>https://forum.processing.org/two/discussion/21687/filtering-is-bugging</link>
      <pubDate>Wed, 29 Mar 2017 20:36:30 +0000</pubDate>
      <dc:creator>gek07</dc:creator>
      <guid isPermaLink="false">21687@/two/discussions</guid>
      <description><![CDATA[<pre><code>PImage img, thresh, selective_random, random, pattern, filter_Img;
float [][] avgfilter = {{1.0/9, 1.0/9, 1.0/9}, {1.0/9, 1.0/9, 1.0/9}, {1.0/9, 1.0/9, 1.0/9}};
float [][] unsharpmask = {{0, -1, 0}, {-1, 5, -1}, {0, -1,0}};
float [][] gausian = {{1.0/16,2.0/16, 1.0/16}, {2.0/16, 4.0/16, 2.0/16}, {1.0/16, 2.0/16,1.0/16}};
void setup()
{
  img = loadImage("flower.jpg");
  img.resize(500, 400);


  filter_Img= createImage(img.width, img.height, RGB);


 // filter_Image(img, gausian,filter_Img);
  filter_Image(img, gausian);
  size(1000, 800);
}
void draw()
{
  image(img, 0, 0);
  image(filter_Img, 500, 0);

}
 void filter_Image(PImage img, float [][] filter )
{ 
  filter_Img=img.get();
  float r = 0 ; 
  float g = 0 ; 
  float b = 0 ;
  for (int i = 0; i &lt; img.width; i++)
    for (int j=0; j &lt; img.height; j++)
    {
      for (int m = -1; m &lt;= 1; m++)
        for (int n =-1; n &lt;=1; n++)
        {

          r = r +  (red(filter_Img.get(i+m, j+n)))*filter[n+1][m+1];
          g = g + (green(filter_Img.get(i+m, j+n)))*filter[n+1][m+1];
          b = b +  (blue(filter_Img.get(i+m, j+n)))*filter[n+1][m+1];
        }
      filter_Img.set(i, j, color(r, g, b));
      r=0;
      g=0;
      b=0;
    }
  filter_Img.updatePixels();
  filter_Img.save(" filter_Img.jpg");
}

   /** void filter_Image(PImage img, float [][] filter ,PImage filter_Img)
    {
      filter_Img=img.get();
      float r = 0 ; 
      float g = 0 ; 
      float b = 0 ;
      for (int i = 0; i &lt; img.width; i++)
        for (int j=0; j &lt; img.height; j++)
        {
          for (int m = -1; m &lt;= 1; m++)
            for (int n =-1; n &lt;=1; n++)
            {

          r = r +  (red(filter_Img.get(i+m, j+n)))*filter[n+1][m+1];
          g = g + (green(filter_Img.get(i+m, j+n)))*filter[n+1][m+1];
          b = b +  (blue(filter_Img.get(i+m, j+n)))*filter[n+1][m+1];
        }
      filter_Img.set(i, j, color(r, g, b));
      r=0;
      g=0;
      b=0;
    }
  filter_Img.updatePixels();
  filter_Img.save(" filter_Img.jpg");
}**/
</code></pre>

<p>When I write down the image as a parameter it all goesa black any help ?</p>
]]></description>
   </item>
   <item>
      <title>Packing float into sampler2D</title>
      <link>https://forum.processing.org/two/discussion/20736/packing-float-into-sampler2d</link>
      <pubDate>Fri, 10 Feb 2017 18:41:04 +0000</pubDate>
      <dc:creator>bradcoleman</dc:creator>
      <guid isPermaLink="false">20736@/two/discussions</guid>
      <description><![CDATA[<p>Hi everybody,</p>

<p>Was hoping anybody here could help me with this...
For a project I want to pack data into a texture and use it in a fragment shader because it can potentially be a lot of data.
Thing is... I need the data as floats in my shader code but I can't seem to get it right.</p>

<p>I wrote a little test case below which illustrates my problem. 
The goal of this sketch is to make the left half of the screen white and the right half of the screen black. That would be the case if the data passed via the texture would be interpreted correctly.</p>

<p>Tried a lot of methods to pack/unpack data, but I'm thinking I got it wrong on the processing side of things. I also noticed that when using println(pixels[0]), the value that gets printed is NOT the same as Float.floatToIntBits gives... so something get's changed.</p>

<p>Anyway, if anybody knows the correct way of passing float values to a shader via a texture and unpacking them from vec4 to float I would be really grateful. Thanks!</p>

<p>Processing sketch:</p>

<pre><code>PShader shader;
PImage sampler;

void setup() {
  size(1280, 720, P2D);

  shader = loadShader("shader.glsl"); 
  shader.set("resolution",1280,720);

  // no texture interpolation
  ((PGraphicsOpenGL)g).textureSampling(3);

  sampler = createImage(2,1,ARGB);   
  sampler.loadPixels();
  sampler.pixels[0]=Float.floatToIntBits(5); // left half of screen &lt; 1
  sampler.pixels[1]=Float.floatToIntBits(15); // right half of screen &gt; 10
  sampler.updatePixels();

  shader.set("sampler",sampler);
}

void draw() {
  filter(shader);
}
</code></pre>

<p>Shader code:</p>

<pre><code>                uniform sampler2D sampler;
                uniform vec2 resolution;

                const vec4 bitEnc = vec4(1.,255.,65025.,16581375.);
                const vec4 bitDec = 1./bitEnc;

                float DecodeFloatRGBA (vec4 v) {
                    return dot(v, bitDec);
                }

                void main(){
                  vec4 test = texture2D(sampler,gl_FragCoord.xy/resolution);
                  float testfloat = DecodeFloatRGBA(test);

                  if (testfloat&lt;10){
                    gl_FragColor=vec4(0,0,0,1);
                  }
                  else{
                    gl_FragColor=vec4(1,1,1,1);
                  }
                }
</code></pre>
]]></description>
   </item>
   <item>
      <title>Copying screen</title>
      <link>https://forum.processing.org/two/discussion/15017/copying-screen</link>
      <pubDate>Fri, 19 Feb 2016 22:23:57 +0000</pubDate>
      <dc:creator>philspitler</dc:creator>
      <guid isPermaLink="false">15017@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I am trying to copy my main Processing output to an off screen buffer (to later send out to some LEDs).</p>

<p>I feel like I'm close but I'm not getting any results.</p>

<p>I have simplified my code and commented the lines that I'm having trouble with.</p>

<pre><code>int y= 1;
PImage tempBuffer;
PGraphics offScreenBuffer;


void setup() {
  size(1280,720);
  offScreenBuffer = createGraphics(16, 9); 
  stroke(255);

}

void draw() {

background (0);
offScreenBuffer.beginDraw();

fill (255,0,0,255);
rect (0,y,1280,80);
y=(y+2) % 720;
loadPixels();


tempBuffer = get(0,0,1280,720); // copy screen to temp buffer
offScreenBuffer.image(tempBuffer, 0, 0,16,9); // copy temp to offscreen and scale to 16x9
offScreenBuffer.copy(0,0,16,9,0,0,160,90); // copy back to the top corner for debug

offScreenBuffer.endDraw();

noFill();
rect(0,0,160,90); // stroke for debug
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Project problems (ParticleSystem / Video)</title>
      <link>https://forum.processing.org/two/discussion/19387/project-problems-particlesystem-video</link>
      <pubDate>Tue, 29 Nov 2016 10:24:45 +0000</pubDate>
      <dc:creator>JamesHewitt</dc:creator>
      <guid isPermaLink="false">19387@/two/discussions</guid>
      <description><![CDATA[<p>Hello all I am new to processing and have a question with regards to how I would fix my code.</p>

<pre><code>import processing.video.*;

Capture video;

PImage prevFrame;

float threshold = 50;

void setup() {
  size(600,400);
  video = new Capture(this, 640, 480,30);
  video.start();
  ps = new ParticleSystem(new PVector(width/2, 50));
  prevFrame = createImage(video.width, video.height, RGB);
}

void captureEvent(Capture video) {
  prevFrame.copy(video, 0, 0, video.width, video.height, 0, 0, video.width, video.height);
  prevFrame.updatePixels();
  video.read();
}

void draw() {
  background(0);
  image(video, 0, 0);
  ps.addParticle();
  ps.run();
  loadPixels();
  video.loadPixels();
  prevFrame.loadPixels();

  float sumX = 0;
  float sumY = 0;
  int motionCount = 0;

  for (int x = 0; x &lt; video.width; x++ ) {
    for (int y = 0; y &lt; video.height; y++ ) {
      color current = video.pixels[x+y*video.width];

      color previous = prevFrame.pixels[x+y*video.width];

      float r1 = red(current);
      float g1 = green(current);
      float b1 = blue(current);
      float r2 = red(previous); 
      float g2 = green(previous);
      float b2 = blue(previous);

      float diff = dist(r1, g1, b1, r2, g2, b2);

      if (diff &gt; threshold){
        sumX += x;
        sumY += y;
        motionCount ++;
      }
    }
  }

  float avgX = sumX / motionCount;
  float avgY = sumY / motionCount;


  smooth();
  noStroke();
  fill(0);
  ellipse(avgX, avgY, 16, 16);
}

  ParticleSystem ps;


class ParticleSystem {
  ArrayList&lt;Particle&gt; particles;
  PVector origin;

  ParticleSystem(PVector position) {
    origin = position.copy();
    particles = new ArrayList&lt;Particle&gt;();
  }

  void addParticle() {
    particles.add(new Particle(origin));
  }

  void run() {
    for (int i = particles.size()-1; i &gt;= 0; i--) {
      Particle p = particles.get(i);
      p.run();
      if (p.isDead()) {
        particles.remove(i);
      }
    }
  }
}

class Particle {
  PVector position;
  PVector velocity;
  PVector acceleration;
  float lifespan;

  Particle(PVector l) {
    acceleration = new PVector(0, 0.05);
    velocity = new PVector(random(-1, 1), random(-2, 0));
    position = l.copy();
    lifespan = 255.0;
  }

  void run() {
    update();
    display();
  }

  void update() {
    velocity.add(acceleration);
    position.add(velocity);
    lifespan -= 1.0;
  }

  void display() {
    stroke(255, lifespan);
    fill(255, lifespan);
    ellipse(avgX, avgY, 8, 8);
  }

  boolean isDead() {
    if (lifespan &lt; 0.0) {
      return true;
    } else {
      return false;
    }
  }
}
</code></pre>

<p>I have two pieces of code with one being able to detect motion and place a dot where it is detected and the other is a particle system and I am trying to place the particle system where movement is detected but I am unsure as to why it is not working, any help is appreciated!</p>
]]></description>
   </item>
   <item>
      <title>Is there a file size limit for the save() method</title>
      <link>https://forum.processing.org/two/discussion/17146/is-there-a-file-size-limit-for-the-save-method</link>
      <pubDate>Tue, 14 Jun 2016 21:31:33 +0000</pubDate>
      <dc:creator>craigson</dc:creator>
      <guid isPermaLink="false">17146@/two/discussions</guid>
      <description><![CDATA[<p>I'm loading an image into memory and manipulating the pixel data inside of my sketch.  However, when I try and use either the save member function of the p5.image object, or the I/O save() method, if the original image was over over a specific size (larger than about 150kb), the download of the manipulated image fails ( the code doesn't throw any errors, but the download fails in the browser, stating "Failed - Network Error".  Is there a known limit to the size of a file that can be saved using either of these methods?</p>

<p>Here's an example of how I'm using the methods:</p>

<p><code>var img = createImage(width, height);
img.save("test", "png");
// or this save(img, "test.png");</code></p>
]]></description>
   </item>
   <item>
      <title>applying a mask flips or rotate the image!</title>
      <link>https://forum.processing.org/two/discussion/14885/applying-a-mask-flips-or-rotate-the-image</link>
      <pubDate>Sat, 13 Feb 2016 02:23:26 +0000</pubDate>
      <dc:creator>gperez</dc:creator>
      <guid isPermaLink="false">14885@/two/discussions</guid>
      <description><![CDATA[<p>Hi. I'm developing in Eclipse. With a kinect (depth sensor).</p>

<p>Currently, I'm trying to mask images. But for some reason as soon I apply a filter, the image flips (or rotates 180º). And I just can't get them back to the current position.</p>

<p>This happens not only with mask() method, but also with other filters (with filter method itself or the blend() one)</p>

<p>I'm giving you an example code:</p>

<p>PGraphics mappingZone;<br />
..
mappingZone = applet.createGraphics(kinect.width, kinect.height, PApplet.P2D);<br />
..
filteredImg = applet.createImage(kinect.width, kinect.height, PApplet.P2D);
...</p>

<pre><code>  mappingZone.beginDraw();
  mappingZone.background(0);            
  mappingZone.image(mappingTexture, 0, 0);
  mappingZone.mask(filteredImg);    
  mappingZone.endDraw();        

  applet.image(mappingZone, 0, 0, applet.width, applet.height);
</code></pre>

<p>I tried several things to flip the image to the correct position, like: 
<code>mappingZone.scale(-1, -1);</code></p>

<p>But nothing works. However, applying a second filter usually return the image to the correct position. Any clue?</p>

<p><img src="https://forum.processing.org/two/uploads/imageupload/901/KLXBH3CSZDSK.jpg" alt="_pic-7016" title="_pic-7016" /></p>
]]></description>
   </item>
   <item>
      <title>Define a function to call another function</title>
      <link>https://forum.processing.org/two/discussion/16751/define-a-function-to-call-another-function</link>
      <pubDate>Sun, 22 May 2016 09:02:52 +0000</pubDate>
      <dc:creator>Sara99</dc:creator>
      <guid isPermaLink="false">16751@/two/discussions</guid>
      <description><![CDATA[<p>How's possibile to define a function that applies another function in a program of color change?</p>
]]></description>
   </item>
   <item>
      <title>loading image from flickr query into draw( )</title>
      <link>https://forum.processing.org/two/discussion/16724/loading-image-from-flickr-query-into-draw</link>
      <pubDate>Fri, 20 May 2016 18:22:34 +0000</pubDate>
      <dc:creator>herringblue</dc:creator>
      <guid isPermaLink="false">16724@/two/discussions</guid>
      <description><![CDATA[<p>Why doesn't the image from the flickr query get displayed in draw( )?</p>

<pre><code>var api = "https://" + "api.flickr.com/services/rest/?method=flickr.photos.search";
var apiKey = "&amp;api_key=a0dd883dc062aadeaec4addb5211da7f";

var tag = "planet"

var query = "&amp;per_page=500&amp;tags=" + tag + "&amp;is_commons=true&amp;format=json&amp;nojsoncallback=1";

var i = 14;

var imgurl;
var img;

function preload() {
 var url = api + apiKey + query;

 loadJSON(url, gotData);


}

function setup() {
 createCanvas(300, 300);
 pixelDensity(1);


}

function gotData(data, imgurl) {

 var farmid = data.photos.photo[i].farm;
 var serverid = data.photos.photo[i].server;
 var id = data.photos.photo[i].id;
 var secret = data.photos.photo[i].secret;

 imgurl = "farm" + farmid + ".staticflickr.com/" + serverid + "/" + id + "_" + secret + ".jpg";

}

function draw() {
img = createImage(imgurl);
image(img,0,0);

}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Can I store another images pixel into a different image's pixel buffer?</title>
      <link>https://forum.processing.org/two/discussion/15065/can-i-store-another-images-pixel-into-a-different-image-s-pixel-buffer</link>
      <pubDate>Mon, 22 Feb 2016 23:27:50 +0000</pubDate>
      <dc:creator>atran</dc:creator>
      <guid isPermaLink="false">15065@/two/discussions</guid>
      <description><![CDATA[<p>Say for example I did pic = loadImage("pic.jpg") and I did pic2 = createImage(width,height,RGB). Would I be able to store pixels of pic into pic2?
  <br />
If I found the right indices could I just do pic2.pixels[location] = color(r , g ,b ), where r g and b are found from the first image like: r = red(pic.pixels[location])?</p>

<p><br /></p>

<p>thank you</p>
]]></description>
   </item>
   <item>
      <title>Adding motion effects</title>
      <link>https://forum.processing.org/two/discussion/14026/adding-motion-effects</link>
      <pubDate>Wed, 16 Dec 2015 17:14:50 +0000</pubDate>
      <dc:creator>mah25z</dc:creator>
      <guid isPermaLink="false">14026@/two/discussions</guid>
      <description><![CDATA[<p>Hey,
How do you add effects in processing?
I have a code that takes screenshots every 1second (total 36seconds) from the webcam however, I need to add some effects (wavey things, or smoke or more fun things into it) 
Hope someone can help
This is the code below:</p>

<p>import processing.sound.*;
import processing.video.*;
SoundFile file;</p>

<p>Capture webcam;
PImage image = createImage(66, 66, RGB);
long lastTime;
int currentImage;
int x = 0;
PImage[] images = new PImage[36];</p>

<p>void setup(){
  fullScreen();
 // file = new SoundFile(this, "sample.mp3");
 // file.play();
  webcam = new Capture( this, width, height );
  image(image, 0, 0, width, height);
  webcam.start();
  lastTime = millis();
  currentImage = 0;
  for ( int i = 0; i&lt; images.length; i++ ){<br />
   images[i] = createImage( 150, 150, RGB );
  }
}</p>

<p>void draw(){
  if( webcam.available() == true ){
    webcam.read();
     if( millis() - lastTime &gt;= 800 ){
      lastTime = millis();
      println( "CAPTURE ", millis() );
      if( currentImage &lt;= 35){
      images[currentImage].copy( webcam, 0, 0, webcam.width, webcam.height, 0, 0, images[currentImage].width, images[currentImage].height );
      currentImage = currentImage + 1;
        //currentImage = 0;
      }
    println( currentImage + 1);
  }
  for(int i = 0; i &lt; 6; i++ ) {
    for(int j = 0; j &lt; 6; j++ ) {
      image(images[j + i<em>6], 150</em>j, 150*i );
    }
  }
  if (x &lt; 100) {
    line(x, 0, x, 100);
    x = x + 1;
  }
//void mousePressed() {
//  if (mouseButton == LEFT) {
//    webcam.start();
//  } else if (mouseButton == RIGHT) {
//    webcam.stop();
//  }
       //if (mousePressed &amp;&amp; (mouseButton == LEFT)) {
     //webcam.start();
    }// else if (mousePressed &amp;&amp; (mouseButton == RIGHT)) {
     // webcam.stop();
  //}
//}
}</p>
]]></description>
   </item>
   <item>
      <title>Problems with using filling bixels from bytes stored in file</title>
      <link>https://forum.processing.org/two/discussion/13454/problems-with-using-filling-bixels-from-bytes-stored-in-file</link>
      <pubDate>Mon, 09 Nov 2015 17:54:31 +0000</pubDate>
      <dc:creator>donuan</dc:creator>
      <guid isPermaLink="false">13454@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I am trying to use <code>PImage</code> to set the pixels of an image from a series of bytes that I have stored in a <code>.txt</code> file which I am importing using <code>readBytes</code>, but I am a bit confused about the loops and I must be doing something wrong because the image does not update and the program does not get out of the loop.</p>

<p>Help would be much appriciated! 
Thanks!</p>

<p>Here is the relevant code:</p>

<pre><code>    PImage finger;
    boolean photoRead = false;

    void setup(){
      size(600,600);
      finger = loadImage("fingerimage.png");
    }

    void draw(){
      if(photoRead == false){
        // Open a file and read its binary data 
        byte b[] = loadBytes("fingerprint.txt"); 
        // Print each value, from 0 to 255 
        for (int i = 0; i &lt; b.length; i++) { 
          // Every 258th number, start a new line 
          if ((i % 258) == 0) { 
            println();
          } 
          // bytes are from -128 to 127, this converts to 0 to 255 
          int a = b[i] &amp; 0xff; 
          int dimension = finger.width * finger.height;
          finger.loadPixels();
          for (int j = 0; j &lt; dimension; j += 1) { 
            finger.pixels[j] = color(a);
          }
          // Print a blank line at the end 
          finger.updatePixels();
          photoRead = true;
        }
      }
   }
</code></pre>
]]></description>
   </item>
   <item>
      <title>Image always appearing as empty</title>
      <link>https://forum.processing.org/two/discussion/10951/image-always-appearing-as-empty</link>
      <pubDate>Fri, 22 May 2015 15:20:06 +0000</pubDate>
      <dc:creator>faizinator</dc:creator>
      <guid isPermaLink="false">10951@/two/discussions</guid>
      <description><![CDATA[<p>I've been trying to get the degree of redness in an RGB image and show it in another image. But the destination image always appears empty. I'm pretty much a newb at processing. here's my code.</p>

<pre><code>//code to get Degree of Redness
import processing.video.*;
Capture cam; 
PImage img,imDeg,imThresh;
void setup()
 {
  imDeg=createImage(320,240,GRAY);
  imThresh=createImage(320,240,GRAY);
  size(640, 480);
  String [] cameras=cam.list();
  cam = new Capture(this,320,240,cameras[0]);
  cam.start(); 
} 

void DegreeRed()
{
  img.loadPixels();
  imDeg.loadPixels();
  for(int x=0;x&lt;320;x++)
  {
    for(int y=0;y&lt;240;y++)
    {

      //location of pixel
      int loc=x*240+y;

      //get RGB values
      float r1=red(img.pixels[loc]);
      float g1=green(img.pixels[loc]);
      float b1=blue(img.pixels[loc]);

      //Degree of Redness
      float r=r1-(g1+b1);
      float g=r1-g1;
      float b=r1-b1;
      if(r&lt;0) r=0;
      if(g&lt;0) g=0;
      if(b&lt;0) b=0;
      float Dr=r+g+b;
      imDeg.pixels[loc]=int(Dr);
    }
  }
  imDeg.updatePixels();
}

void draw() 
{
  scale(2);
  if (cam.available()) { 
    // Reads the new frame
    cam.read(); 
  }
  img=cam;
  DegreeRed();
  //Thresh();
  image(imDeg, 0, 0); 
}
</code></pre>

<p>I'm continuously taking images from a camera and passing it through this function and printing the resulting imDeg image on the screen. But the image always appears empty. Thank You for your help.</p>
]]></description>
   </item>
   <item>
      <title>Trying to find the colour of the pixels of an image I am loading....</title>
      <link>https://forum.processing.org/two/discussion/10953/trying-to-find-the-colour-of-the-pixels-of-an-image-i-am-loading</link>
      <pubDate>Fri, 22 May 2015 19:16:37 +0000</pubDate>
      <dc:creator>jonhaber</dc:creator>
      <guid isPermaLink="false">10953@/two/discussions</guid>
      <description><![CDATA[<p>I am trying to find the colour underneath my mouse pointer. I want to be able to load an image from a local folder selected by a user (ie through a file window open dialogue box) then scroll over any part of the image and capture the RGB value below my pointer.</p>

<p>Currently the html code loads an image to the screen but then p5 cannot read the value of the pixel of the loaded image (I believe because they are being drawn to separate frames/canvases ?) It is correctly reading colour of pixels of things drawn in the sketch.js file (below this is shown with a test shape - a red circle)</p>

<p>Thanks for the help. Code below...</p>

<p>index.html</p>

<pre lang="javascript">





  
  function handleFileSelect(evt) {
    var files = evt.target.files; // FileList object

    // Loop through the FileList and render image files.
    for (var i = 0, f; f = files[i]; i++) {

      // Only process image files.
      if (!f.type.match('image.*')) {
        continue;
      }

      var reader = new FileReader();

      // Closure to capture the file information.
      reader.onload = (function(theFile) {
        return function(e) {
          // Render image.
          var span = document.createElement('span');
          span.innerHTML = ['img src="', e.target.result,
                            '" title="', escape(theFile.name), '"/&gt;'].join('');
          document.getElementById('list').insertBefore(span, null);
        };
      })(f);

      // Read in the image file as a data URL.
      reader.readAsDataURL(f);
    }
  }

  document.getElementById('files').addEventListener('change', handleFileSelect, false);


  
  
   body {padding: 0; margin: 0;} 





</pre>

<hr />

<p>sketch.js</p>

<pre>
function setup(){
  colorMode(RGB, height, height, height);
  createCanvas(1024, 768);

}

function draw() {
  // put drawing code here
  fill("red");
  ellipse(50, 50, 80, 80); // putting something on the sketch canvas
}

function mouseMoved(){
    var color_under_mouse = get(mouseX, mouseY);
    println(mouseX);
    println(mouseY);
    println(color_under_mouse);
}
</pre>
]]></description>
   </item>
   <item>
      <title>blur image over 10 frames</title>
      <link>https://forum.processing.org/two/discussion/10685/blur-image-over-10-frames</link>
      <pubDate>Thu, 07 May 2015 11:23:04 +0000</pubDate>
      <dc:creator>processingnerd</dc:creator>
      <guid isPermaLink="false">10685@/two/discussions</guid>
      <description><![CDATA[<p>Hi everybody! I am trying to blur my image over 10 frames. This is the coding for the blur. I have already set the frame rate, but it only changes quickly and not over 10 frames. Any ideas?</p>

<pre><code>PImage blurImg = createImage(img2.width, img2.height, RGB);

//Loop through every pixel in the image  
  for (int y = 1; y &lt; img2.height-1; y++) {   // Skip top and bottom edges
  for (int x = 1; x &lt; img2.width-1; x++) {  // Skip left and right edges

    int loc = x + (y*img2.width); // Current pixel location
    float sumr = 0; // Kernel sum for this pixel 
    float sumg = 0;
    float sumb = 0;
    for (int ky = -1; ky &lt;= 1; ky++) {
    for (int kx = -1; kx &lt;= 1; kx++) {

// Calculate the adjacent pixel for this kernel point
   int pos = (y + ky)*img2.width + (x + kx);

// Image is grayscale, red/green/blue are identical
   float valr = red(img2.pixels[pos]);
   float valg = green(img2.pixels[pos]);
   float valb = blue(img2.pixels[pos]);

// Multiply adjacent pixels based on the kernel values
   sumr += kernel[ky+1][kx+1] * valr;
   sumg += kernel[ky+1][kx+1] * valg;
   sumb += kernel[ky+1][kx+1] * valb;
 }
}

// For this pixel in the new image, set the gray value
// based on the sum from the kernel
   blurImg.pixels[y*img2.width + x] = color(sumr,sumg,sumb);
    }
  }

// State that there are changes to blurImg.pixels[]
  blurImg.updatePixels();

  image(blurImg, 0, 0); //Blur image

    }
</code></pre>

<p>I'm very new to this, so sorry if its unclear..
Thank you!</p>
]]></description>
   </item>
   <item>
      <title>hello, this code is for the passage of a blur image, need help for understand this code</title>
      <link>https://forum.processing.org/two/discussion/5318/hello-this-code-is-for-the-passage-of-a-blur-image-need-help-for-understand-this-code</link>
      <pubDate>Thu, 22 May 2014 03:41:45 +0000</pubDate>
      <dc:creator>niita</dc:creator>
      <guid isPermaLink="false">5318@/two/discussions</guid>
      <description><![CDATA[<pre><code>PImage imgmdr = createImage(img.width, img.height, RGB);
  float v = 1.0 / 9.0;//definit une matrice de 3*3qui est notre kernel v= comme suite (1+2+..+n)n fois/9
  float[][] kernel = {
    { 
      v, v, v 
    }
    , 
    { 
      v, v, v
    }
    , 
    { 
      v, v, v
    }
  };

  // Loop through every pixel in the image
  for (int y = 1; y &lt; img.height-1; y++) {   // BORDS SUPERIEUR ET INF
    for (int x = 1; x &lt; img.width-1; x++) {  // BORDS GAUCHE ET DROITE
      float sumr = 15; // Kernel SOMME de ces pixels
      float sumg = 8;
      float sumb = 2;
      for (int ky = -1; ky &lt;= 1; ky++) {
        for (int kx = -1; kx &lt;= 1; kx++) {
          // Calculate the adjacent pixel for this kernel point
          int pos = (y + ky)*img.width + (x + kx);
          // l'image est en niveaux de gris, rouge/vert/bleu identiques
          float valr = red(img.pixels[pos]);
          float valg = green(img.pixels[pos]);
          float valb = blue(img.pixels[pos]);

          // Multiplier pixels adjacents sur la base des valeurs de noyau
          sumr += kernel[ky+1][kx+1] * valr;
          sumg += kernel[ky+1][kx+1] * valg;
          sumb += kernel[ky+1][kx+1] * valb;
        }
      }
      // For this pixel in the new image, set the gray value
      // based on the sum from the kernel
      imgmdr.pixels[y*img.width + x] = color(sumr, sumg, sumb);
    }
  }
  // Image changée face à edgeImg.pixels[]
  imgmdr.updatePixels();

  //image(imgmdr, 0, 0); // Draw the new image

  return imgmdr;
}
</code></pre>

<p>I would like that someone explain me this code cuz i don't understand what's correspond of sumr, why a ' k ' .... Thx to reply me</p>
]]></description>
   </item>
   </channel>
</rss>