<?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 #image - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=%23image</link>
      <pubDate>Sun, 08 Aug 2021 19:18:47 +0000</pubDate>
         <description>Tagged with #image - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/tagged%23image/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Can Colors Change With Time</title>
      <link>https://forum.processing.org/two/discussion/18968/can-colors-change-with-time</link>
      <pubDate>Thu, 10 Nov 2016 02:03:05 +0000</pubDate>
      <dc:creator>magoo</dc:creator>
      <guid isPermaLink="false">18968@/two/discussions</guid>
      <description><![CDATA[<p>Hey, I am relatively new to code and Processing, but think it might work well for a project I am working on. I am wondering if it would be possible to make an image's tones change based on the changing time, and then have this displayed constantly. I don't need a specific how to, I just want to know if this would be possible and then I would try to learn how to do it myself. Thanks for the help!</p>
]]></description>
   </item>
   <item>
      <title>Help with Images</title>
      <link>https://forum.processing.org/two/discussion/16179/help-with-images</link>
      <pubDate>Thu, 21 Apr 2016 22:22:27 +0000</pubDate>
      <dc:creator>abrown17</dc:creator>
      <guid isPermaLink="false">16179@/two/discussions</guid>
      <description><![CDATA[<p>Hello! So I have 3 images displayed on a screen and am trying to get it so when I roll over an image it becomes tinted. I thought that I had the correct code but when I implement the section of the code that is supposed to shade my images, none of my images show up. Without the tinting portion of the code, the images do show up. Can anybody help me with this problem? Posted below is my code for the project. The problem deals with main, the Images class, and the population class, but I have included the rest of the classes for the project as well.</p>

<p>Main:</p>

<p>Images photoimg;
population population;
Button button;</p>

<p>void settings() {   //Setup the box containing the images
  size(1600,600);
}</p>

<p>void setup() {
  colorMode(RGB,1.0); 
  int popmax = 3;
  //float mutationRate = 0.05;  // A pretty high mutation rate here, our population is rather small we need to enforce variety
  // Create a population with a target phrase, mutation rate, and population max
  //population = new Population(mutationRate,popmax);
  population = new population(popmax); //create a new population
  button = new Button(15,560,160,20, "Evolve new generation"); //create a button
  //photoimg = new Images();
}</p>

<p>void draw() {
  background(1.0);
  // Display the faces
  population.display();
  population.rollover(mouseX,mouseY);
  // Display some text
  textAlign(LEFT);
  fill(0);
  //text("Generation #:" + population.getGenerations(),15,190);</p>

<p>// Display the button
  button.display();
  button.rollover(mouseX,mouseY);
}</p>

<p>void mousePressed() {
  if (button.clicked(mouseX,mouseY)) {
    //population.selection();
    //population.reproduction();
  }
}</p>

<p>void mouseReleased() {
  button.released();</p>

<h2>}</h2>

<p>class Images{
  float increment = 0.02; 
  float x, y; //postion of image
  int w, h;
  PImage photoimg, destination;
  //int wh = 600;
  boolean rolloverOn, clickedOn = false;</p>

<p>Rectangle r;</p>

<p>Images(float x_, float y_)
  {
    x = x_; 
    y = y_;
    photoimg = new PImage();
    photoimg = loadImage("jefferson.jpg");
    w = photoimg.width;
    h = photoimg.height;
    //r = new Rectangle(int(x), int(y), int(wh), int(wh));
    //destination = perlin(photoimg);
  }</p>

<p>/<em>void settings(){
    size(500,500);
  }</em>/</p>

<p>void display(){
    //update(mouseX, mouseY);</p>

<pre><code>pushMatrix();
translate(x, y);
//stroke(255);
//image(photoimg,0,0);
//popMatrix();
noStroke();
/*if (rolloverOn == true){
  tint(100);
}
else{
  tint(255);
}*/
//stroke(255);
image(photoimg,0,0);
//image(destination,0,0);    
popMatrix();
</code></pre>

<p>}</p>

<p>void update(int mx, int my) {
  if( roll_over(mx, my, photoimg.width, photoimg.height) ) {
    rolloverOn = true;
  }
  else {
    rolloverOn = false;
  }
}</p>

<p>//position, width, height
  boolean roll_over(int p, int z, int w, int h){ 
    if (p &gt;= x &amp;&amp; p &lt;= x+w &amp;&amp; 
      z &gt;= y &amp;&amp;  z &lt;= y+h) {
        //tint(100);
        return true;
      } 
      else {
        //tint(255);
        return false;
      } 
  }</p>

<p>boolean clicked(int mx, int my) {
    if (r.contains(mx,my)) clickedOn = true;
    return clickedOn;
  }
}</p>

<hr />

<p>class population {</p>

<p>Images[] population;
  int generations;</p>

<p>population(int num) {
    population = new Images[num];
    generations=0;
    for (int i = 0; i &lt; population.length; i++) { 
      population[i] = new Images(15+i*530, 30);
    }
  }</p>

<p>void display() {
    for (int i = 0; i &lt; population.length; i++) {
      population[i].display();
    }
  }</p>

<p>void rollover(int mx, int my) {
    for (int i = 0; i &lt; population.length; i++) {
      population[i].update(mx, my);
    }
  }</p>

<hr />

<p>class Rectangle {
   int x;
   int y;
   int width;
   int height;</p>

<p>Rectangle(int x_, int y_, int w, int h) {
     x = x_;
     y = y_;
     width = w;
     height = h;
   }</p>

<p>boolean contains(int px, int py) {
     return (px &gt; x &amp;&amp; px &lt; x + width  &amp;&amp; py &gt; y &amp;&amp; py &lt; y + height);
   }</p>

<p>}</p>

<hr />

<p>class Button {
  Rectangle r;  // Button's rectangle
  String txt;   // Button's text
  boolean clickedOn;  // Did i click on it?
  boolean rolloverOn; // Did i rollover it?</p>

<p>Button(int x, int y, int w, int h, String s) {
    r = new Rectangle(x,y,w,h);
    txt = s;
  }</p>

<p>void display() {
    // Draw rectangle and text based on whether rollover or clicked
    rectMode(CORNER);
    stroke(0); noFill();
    if (rolloverOn) fill(0.5);
    if (clickedOn) fill(0);
    rect(r.x,r.y,r.width,r.height);
    float b = 0.0;
    if (clickedOn) b = 1;
    else if (rolloverOn) b = 0.2;
    else b = 0;
    fill(b);
    textAlign(LEFT);
    text(txt,r.x+10,r.y+14);</p>

<p>}</p>

<p>// Methods to check rollover, clicked, or released (must be called from appropriate
  // Places in draw, mousePressed, mouseReleased
  boolean rollover(int mx, int my) {
    if (r.contains(mx,my)) rolloverOn = true;
    else rolloverOn = false;
    return rolloverOn;
  }</p>

<p>boolean clicked(int mx, int my) {
    if (r.contains(mx,my)) clickedOn = true;
    return clickedOn;
  }</p>

<p>void released() {
    clickedOn = false;
  }</p>

<p>}</p>

<hr />

<p>Thank you!</p>
]]></description>
   </item>
   <item>
      <title>Get random images form a web page like Google images, tumblr, Flickr.</title>
      <link>https://forum.processing.org/two/discussion/15028/get-random-images-form-a-web-page-like-google-images-tumblr-flickr</link>
      <pubDate>Sat, 20 Feb 2016 19:35:47 +0000</pubDate>
      <dc:creator>maxarch</dc:creator>
      <guid isPermaLink="false">15028@/two/discussions</guid>
      <description><![CDATA[<p>I will like to know any link , project or library that can help me understand the process to get a random image from a key word or #tag.</p>

<p>I will like to be able in my sketch to place a keyword  example like "kanye west" so it goes to  Google images, tumblr or Flickr.From the  3 or 6 first page  take 1 (10 or 15) image bigger than 600px .  And display the image randomly.</p>

<p>I will also  like to be able form  the key word it will go Wikipedia page. Get the first part of the text everything between the title and the content and display it.
Same thing from tweeter get some random tweet about the key word.</p>

<p>Hope somebody will be able to give me information about that where to look for it.</p>
]]></description>
   </item>
   <item>
      <title>compare Image</title>
      <link>https://forum.processing.org/two/discussion/15246/compare-image</link>
      <pubDate>Wed, 02 Mar 2016 14:49:58 +0000</pubDate>
      <dc:creator>lviensen</dc:creator>
      <guid isPermaLink="false">15246@/two/discussions</guid>
      <description><![CDATA[<p>I need to compare these two frequencies and generate a similarity score .</p>

<p><img src="https://forum.processing.org/two/uploads/imageupload/194/4KEPEC5H1P51.png" alt="image" title="image" /></p>
]]></description>
   </item>
   <item>
      <title>Best way to draw lots of images on screen without getting a low FrameRate?</title>
      <link>https://forum.processing.org/two/discussion/15108/best-way-to-draw-lots-of-images-on-screen-without-getting-a-low-framerate</link>
      <pubDate>Thu, 25 Feb 2016 04:51:54 +0000</pubDate>
      <dc:creator>dojoblue25</dc:creator>
      <guid isPermaLink="false">15108@/two/discussions</guid>
      <description><![CDATA[<p>I'm currently working on a game which will draw a grid of blocks in which you can place and remove blocks, the amount of images it has to draw seems to lag it fairly easily and I'm wondering if there's a better way than just using image() to draw each block, one at a time.</p>
]]></description>
   </item>
   <item>
      <title>Making a copy of an image</title>
      <link>https://forum.processing.org/two/discussion/14679/making-a-copy-of-an-image</link>
      <pubDate>Sat, 30 Jan 2016 05:11:46 +0000</pubDate>
      <dc:creator>CantSayIHave</dc:creator>
      <guid isPermaLink="false">14679@/two/discussions</guid>
      <description><![CDATA[<p>Quick question -</p>

<p>I know if I have a PImage "Shape" and I try to make a copy of Shape by saying</p>

<pre><code>PImage copyShape = Shape;
</code></pre>

<p>I'll only create a reference to Shape.</p>

<p>How do I make a separate copy?</p>

<p>Thanks</p>
]]></description>
   </item>
   <item>
      <title>How to resize my loadImage?</title>
      <link>https://forum.processing.org/two/discussion/14287/how-to-resize-my-loadimage</link>
      <pubDate>Wed, 06 Jan 2016 04:47:37 +0000</pubDate>
      <dc:creator>Hooga</dc:creator>
      <guid isPermaLink="false">14287@/two/discussions</guid>
      <description><![CDATA[<p>I originally got a program that reads the pixels in a picture, In order for it to work the picture has to be the same size as the  canvas or for you to see it. Well I loaded in a 1920 x 1080 picture and loaded it into a 1000 x 500 canvas, I set the images
(<code>image(img, 0, 0, width, height);</code>) size to the height and the width of the canvas, but when I load the picture using the <code>loadImage</code> method it loads the image in its original resolution in the background where I cant see it, I want it to load the image into the size of the canvas, how can I accomplish this?
Code:</p>

<pre><code>PImage img;
int direction = 1;
float signal;
int imgX = 0;
int imgY = 0;
int w = width;
int h = height;




void setup() {
  size(1000, 500);
  //fullScreen();
  noFill();
  frameRate(60);
}




void draw() {
  // int boxX = img.width/2;
  //int boxY = img.height/2;
  img = loadImage("203.jpg");

  background(255);



  if (mousePressed) {
    int mx = constrain(mouseX, 0, width-1);
    int my = constrain(mouseY, 0, height-1);
    signal = my*width + mx;
  } else {
    //signal += 0.33*direction;
  }

 // set(imgX, imgY, img);  // fast way to draw an image

  int sx = int(signal) % width;
  int sy = int(signal) / width;
  color c = img.get(sx, sy);
  image(img, 0, 0, width, height);


  //rect(sx, sy, 10, 10);
  fill(c);
  rect(50, 50, 50, 50);

  print("Color " + c);
  println(" X " + sx + " Y " + sy );
}
</code></pre>

<p>In order for this code to work you have to set the canvas size to the resolution of the image, and I do not want that. Plus the canvas size cannot be re-sized.</p>

<h2>If you run this program at the top left corner you will see a box that will copy the color of the pixel where your mouse is at, hover over any pixel to see what my problem is.</h2>
]]></description>
   </item>
   <item>
      <title>How do I sort pixels in the pixels[] array?</title>
      <link>https://forum.processing.org/two/discussion/14264/how-do-i-sort-pixels-in-the-pixels-array</link>
      <pubDate>Tue, 05 Jan 2016 02:33:32 +0000</pubDate>
      <dc:creator>Hooga</dc:creator>
      <guid isPermaLink="false">14264@/two/discussions</guid>
      <description><![CDATA[<p>I want to get an image and take its pixels and load them into a shape, how do I know which pixels from the pixels[] array?
The fact that some HD images are over millions of pixels is kinda of unsettling. How can I sort the pixels?</p>
]]></description>
   </item>
   <item>
      <title>Can someone Explain exactly how this program works?</title>
      <link>https://forum.processing.org/two/discussion/14265/can-someone-explain-exactly-how-this-program-works</link>
      <pubDate>Tue, 05 Jan 2016 03:13:41 +0000</pubDate>
      <dc:creator>Hooga</dc:creator>
      <guid isPermaLink="false">14265@/two/discussions</guid>
      <description><![CDATA[<pre><code>PImage img;
int direction = 1;
float signal;

void setup() {
    size(640, 360);
    noFill();
    stroke(255);
    frameRate(30);
    img = loadImage("moonwalk.jpg");
}

void draw() {
     if (signal &gt; img.width*img.height-1 || signal &lt; 0) { 
     direction = direction * -1; 
}

    if (mousePressed) {
        int mx = constrain(mouseX, 0, img.width-1);
        int my = constrain(mouseY, 0, img.height-1);
        signal = my*img.width + mx;
  } else {
       signal += 0.33*direction;
    }

  int sx = int(signal) % img.width;
  int sy = int(signal) / img.width;

    if (keyPressed) {
        set(0, 0, img);  // fast way to draw an image
        point(sx, sy);
        rect(sx - 5, sy - 5, 10, 10);
   } else {
        color c = img.get(sx, sy);
        background(c);
       }
}
</code></pre>

<p>This code is from <a rel="nofollow" href="https://processing.org/examples/pixelarray.html">the processing website</a> it takes an image and gets its pixels and displays them on the screen based on where your mouse is is, but they failed at explaining exactly what every line, I am completely confused, can anyone explain in detail what every line does here?</p>
]]></description>
   </item>
   <item>
      <title>how convert image to image 3 bits, 8 colors???</title>
      <link>https://forum.processing.org/two/discussion/13986/how-convert-image-to-image-3-bits-8-colors</link>
      <pubDate>Tue, 15 Dec 2015 05:56:39 +0000</pubDate>
      <dc:creator>Omnimusha</dc:creator>
      <guid isPermaLink="false">13986@/two/discussions</guid>
      <description><![CDATA[<pre><code>input_.loadPixels();
for(int r=0;r&lt;58;r++){ 
    for(int x=0 ;x&lt; 58;x++){

        int inputIndex =  x + r * input_.width;
        int rr = (input_.pixels[inputIndex] &gt;&gt; 16) &amp; 240;
        int v = (input_.pixels[inputIndex] &gt;&gt; 8) &amp; 240;
        int b = input_.pixels[inputIndex] &amp; 240;

        input_.pixels[inputIndex] = color(rr, v, b);
    }
}
input_.updatePixels();
image(input_, 0, 0);
</code></pre>
]]></description>
   </item>
   <item>
      <title>what path to use to get from an outer class an image which is in the P5 data folder</title>
      <link>https://forum.processing.org/two/discussion/12576/what-path-to-use-to-get-from-an-outer-class-an-image-which-is-in-the-p5-data-folder</link>
      <pubDate>Fri, 18 Sep 2015 16:44:48 +0000</pubDate>
      <dc:creator>akenaton</dc:creator>
      <guid isPermaLink="false">12576@/two/discussions</guid>
      <description><![CDATA[<p>i have an app (P5, osX 10.6.8) which has a class extending JFrame class.</p>

<p>In this class i create a JFrame instance: let us call it "frame".
Not any problem.</p>

<p>Then i want to add a panel to this frame
So i code:</p>

<pre><code>     JPanel panel = new JPanel();
     panel.setLayout(new BorderLayout());

    panel.setPreferredSize(new Dimension(wid, heigh));// these parameters are passed by constructor.
</code></pre>

<p>Not any problem: the frame appears (after having add pack() and setVisible()) with size and location as required.</p>

<p>Then i want to add an IMAGE to my panel;
this image IS in the data folder from the sketch; i have also put a copy near the class itself at sketch root.</p>

<p>and i code:</p>

<pre><code>    JLabel label = new JLabel();
    label.setIcon(new ImageIcon("/data/myImage.jpg");
    //or:(trying..)
    label.setIcon(new ImageIcon("myImage.jpg");
    //or
     label.setIcon(new ImageIcon("data/myImage.jpg");
</code></pre>

<p>then, as usually:</p>

<pre><code>    this.frame.getContentPane().add(panel);
    this.frame.pack();
    this.frame.setVisible(true); 
</code></pre>

<p>the frame appears but not the image. Not any error.</p>

<p>In order to understand why, i add:</p>

<p><code>System.out.println(new File("myImage.jpg").exists());</code></p>

<p>it returns false (of course i have tried changing the path, without success)…</p>

<p>So i have add another method in order to see where the class is looking at:</p>

<pre><code>            private void whereAreYouLookingAt(){
            try{
             File file = new File(".");  
             File[] files = file.listFiles();  
             System.out.println("Current dir : " + file.getCanonicalPath());
             for (int fileInList = 0; fileInList &lt; files.length; fileInList++)  
             {  
                  System.out.println(files[fileInList].toString());  
                }
            }catch(IOException ex){
            }

            }
</code></pre>

<p>it runs and print all files which are present in my Applications folder (osX)!!!
of course the image is not here...
but WHY is it pointing there???
Is it because here is the Processing folder???? - i think so. Not sure...</p>

<p>After that (in order to verify again) i add::</p>

<p><code>System.out.println(new File("data/myImage.jpg").getAbsolutePath());</code></p>

<p>it returns:       /Applications/data/myImage.jpg</p>

<p>Finally, in order to be sure that my code is good (it fires no error…) i have HARDCODED the path to myImage.jpg (sketch folder, data folder…)
and the image appears in the frame!</p>

<p>Of course this is not a good solution... If anybody can explain what to do in this type of case (what path to use in an outer class which uses Image java class and not PImage) thanks in advance.</p>

<p>PS: i have found a workaround but i want to understand.
thanks in advance.</p>
]]></description>
   </item>
   <item>
      <title>Integrating background subtraction and brightness tracking</title>
      <link>https://forum.processing.org/two/discussion/12294/integrating-background-subtraction-and-brightness-tracking</link>
      <pubDate>Sat, 29 Aug 2015 08:15:18 +0000</pubDate>
      <dc:creator>Sulaimanismzz</dc:creator>
      <guid isPermaLink="false">12294@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys, 
I am doing a project to track the motion of a quad, Since i want it to be simple i pick brightness tracking since it is easy to track the x and y co-ordinate values, and this works fine for indoor environment. But once i tried in outdoor i find difficulty since the code confuses to track the brightness available in outdoor, so i thought of integrating background subtraction and brightness tracking. But i find difficulty in it. Any possible ways to integrate those codes? Ping me if you got my idea</p>
]]></description>
   </item>
   <item>
      <title>Making several buttons with images</title>
      <link>https://forum.processing.org/two/discussion/12193/making-several-buttons-with-images</link>
      <pubDate>Fri, 21 Aug 2015 11:26:32 +0000</pubDate>
      <dc:creator>Gromek999</dc:creator>
      <guid isPermaLink="false">12193@/two/discussions</guid>
      <description><![CDATA[<p>I am currently trying to make a few buttons using images that ofcourse change when you press the button.
I am using the code from here: <a href="http://processingjs.org/learning/topic/imagebutton/" target="_blank" rel="nofollow">http://processingjs.org/learning/topic/imagebutton/</a>
but I cannot whatever I do, find out how to make more than one button appear at the same time.
there is also the problem that the button activates with a press, not a release. which is a problem because I can press on a side of the screen, drag my mouse over the button and it then activates.</p>
]]></description>
   </item>
   <item>
      <title>Wie erstelle ich eine random-Funktion?</title>
      <link>https://forum.processing.org/two/discussion/11837/wie-erstelle-ich-eine-random-funktion</link>
      <pubDate>Sat, 25 Jul 2015 16:29:37 +0000</pubDate>
      <dc:creator>Jennifer</dc:creator>
      <guid isPermaLink="false">11837@/two/discussions</guid>
      <description><![CDATA[<p>Hallo,</p>

<p>ich hoffe hier sind auch einige Deutsche unter euch. Ich kenne mich in Processing leider gar nicht aus und muss ein Projekt darin machen. Verstehe so schon recht wenig, auf Englisch gleich gar nichts mehr.</p>

<p>Ich habe verschiedene Bilder, die nach einem Klick per Zufall erscheinen sollen. Es geht um einen Lebensweg, deswegen darf der Zufall nicht ganz wahllos sein.
Der Betrachter entscheidet sich für Möglichkeit A oder B. Entscheidet er sich für B, kommt per Zufall ein Bild aus 2 Möglichkeiten. Je nachdem welches erscheint, kommt darauf das nächste Bild wieder aus 2 Möglichkeiten. Wie ein Baumdiagramm.</p>

<p>Benötige dringend Hilfe. Danke im voraus!</p>
]]></description>
   </item>
   <item>
      <title>making a pixel to binary converter</title>
      <link>https://forum.processing.org/two/discussion/11741/making-a-pixel-to-binary-converter</link>
      <pubDate>Fri, 17 Jul 2015 14:15:42 +0000</pubDate>
      <dc:creator>johanispro3</dc:creator>
      <guid isPermaLink="false">11741@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I'm new here to processing and to programming in general. I've tried to get into coding but I never had a goal to work to. Now I finally found something I want to build: a program that converts a image that you can draw yourself into a binary code.</p>

<p>I've made a simple start; a drawing program with erasing tool that draws a black line on white. but I'm running into 2 problems</p>

<p>1: zooming in, I want to convert a 16x16 image to binary but making a screen of that size is just way too small. I need to find a way to make it bigger without changing resolution.</p>

<p>2: The actual conversion a black pixel needs to become a 1 and a white (background) needs to become a 0. example of a 3x3 output: (every code is a horizontal row)</p>

<pre><code>101
010
101
</code></pre>

<p>a friend of mine told me it's handy to use a bit shifter for this, but I just don't know how!</p>

<p>Any help would be appreciated.</p>
]]></description>
   </item>
   <item>
      <title>How to receive an image with UDP?</title>
      <link>https://forum.processing.org/two/discussion/11091/how-to-receive-an-image-with-udp</link>
      <pubDate>Sun, 31 May 2015 22:19:52 +0000</pubDate>
      <dc:creator>GuadaAlvarez</dc:creator>
      <guid isPermaLink="false">11091@/two/discussions</guid>
      <description><![CDATA[<p>Hi! I'm using UDP to send an image from a program to another.</p>

<p>this function sends the image with UDP to the other program when the facedetect detects a face in a video/camera</p>

<pre><code>void sendImg(PImage img){
  BufferedImage bimg = new BufferedImage( img.width,img.height, BufferedImage.TYPE_INT_RGB );
  img.loadPixels();
  bimg.setRGB( 0, 0, img.width, img.height, img.pixels, 0, img.width);
  ByteArrayOutputStream baStream  = new ByteArrayOutputStream();
  BufferedOutputStream bos    = new BufferedOutputStream(baStream);

  Iterator iter = ImageIO.getImageWritersByFormatName("jpeg");
  ImageWriter writer = (ImageWriter)iter.next();

  ImageWriteParam iwp = writer.getDefaultWriteParam();
  iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);

  ImageOutputStream stream = null;

  try {
    stream = ImageIO.createImageOutputStream(bos) ;
  } 
  catch (IOException e) {
    e.printStackTrace();
  }

  writer.setOutput(stream);

  IIOImage imgb = new IIOImage(bimg, null, null);

  try {
    writer.write(null, imgb, iwp);
  } 
  catch (IOException e) {
    e.printStackTrace();
  }

  writer.dispose();
  byte[] packet = baStream.toByteArray();
  println("Sending datagram with " + packet.length + " bytes");
  try {
    ds.send(new DatagramPacket(packet,packet.length, InetAddress.getByName(ip),clientPort));
  } 
  catch (Exception e) {
    e.printStackTrace();
  } 
}
</code></pre>

<p>but in the other program I don't know how to do to receive this array of bites and save it as an image jpg in a data carpet. 
Someone knows how to do it or has any suggestion?</p>
]]></description>
   </item>
   <item>
      <title>got problem loadImage in p5JS</title>
      <link>https://forum.processing.org/two/discussion/11003/got-problem-loadimage-in-p5js</link>
      <pubDate>Mon, 25 May 2015 22:36:54 +0000</pubDate>
      <dc:creator>james_cao</dc:creator>
      <guid isPermaLink="false">11003@/two/discussions</guid>
      <description><![CDATA[<p>here is the problem when i type the example of loadImage in my js file, and load the image in the folder"assets" which were located between the index.html and sketch.js, there is no image pop up after i run it to browser. i think its simple but i could not get it ,any one help please.
<img src="" alt="" /><img src="http://forum.processing.org/two/uploads/imageupload/988/ZCNQ0BF4RDSD.png" alt="Screenshot 2015-05-25 18.20.17" title="Screenshot 2015-05-25 18.20.17" /></p>
]]></description>
   </item>
   <item>
      <title>Display whole image sequence</title>
      <link>https://forum.processing.org/two/discussion/10755/display-whole-image-sequence</link>
      <pubDate>Mon, 11 May 2015 20:22:05 +0000</pubDate>
      <dc:creator>processingnerd</dc:creator>
      <guid isPermaLink="false">10755@/two/discussions</guid>
      <description><![CDATA[<p>Hi everyone,</p>

<p>I have a sketch full of different transformations to a picture each happening over a certain amount of frames by a press of a key. I divided each transformation into each void. I now want to display ALL of the transformations over 100 frames by a press of the key once (within the same sketch). How do I do this?</p>

<p>Thanks for any help :)</p>
]]></description>
   </item>
   <item>
      <title>Invert image colour over 10 frames</title>
      <link>https://forum.processing.org/two/discussion/10686/invert-image-colour-over-10-frames</link>
      <pubDate>Thu, 07 May 2015 11:29:29 +0000</pubDate>
      <dc:creator>processingnerd</dc:creator>
      <guid isPermaLink="false">10686@/two/discussions</guid>
      <description><![CDATA[<p>Hi everyone. I currently have inverted the colours of my image, however, when i put it in my sketch with the other functions, it only flashes many times, rather than actually changing gradually over 10 frames. I have set the frame rate to 10 frames, but put together with with my previous image transformation it will not work. How do I make it gradually transform over 10 frames?</p>

<p>The image is a colourful picture, 1280 x 720.</p>

<pre><code>//Inverting image colour
void invertColor() {
background(img1);
image(img1,0,0);

for (int x = 0; x &lt; img1.width; x++) {
        for(int y = 0; y &lt;img1.height;y++) {
          color c = get(x,y);
          img1.set(x,y, color(255-red(c), 255-green(c), 255-blue(c)));

  }
 }
}
</code></pre>

<p>I'm very new to this, so sorry if it's unclear or confusing :/ 
I can give more information if needed.
Thank you.</p>
]]></description>
   </item>
   <item>
      <title>Image quilting with Processing</title>
      <link>https://forum.processing.org/two/discussion/10285/image-quilting-with-processing</link>
      <pubDate>Sun, 12 Apr 2015 15:50:43 +0000</pubDate>
      <dc:creator>clayh</dc:creator>
      <guid isPermaLink="false">10285@/two/discussions</guid>
      <description><![CDATA[<p>Hi - I recently implemented Effros/Freeman's image quilting algorithm in Processing. That allows you to take a small texture image and knit together multiple samples of it to create a larger image that doesn't look tiled. More info <a rel="nofollow" href="http://graphics.cs.cmu.edu/people/efros/research/quilting.html">through here</a>.</p>

<p>For example, starting with:</p>

<p><img src="https://github.com/tricoders/texture-synthesis/blob/master/Image_Quilting/data/pinkflowers.png?raw=true" alt="" /></p>

<p>You can end up with this:</p>

<p><img src="https://github.com/tricoders/texture-synthesis/blob/master/img/largepink.png?raw=true" alt="" /></p>

<p>Another example:</p>

<p><img src="https://github.com/tricoders/texture-synthesis/blob/master/Image_Quilting/data/darkgrass.png?raw=true" alt="" /></p>

<p><img src="https://github.com/tricoders/texture-synthesis/blob/master/img/largedarkgrass.png?raw=true" alt="" /></p>

<p>Anyhow, you can find and play with the source code here. The Effros-Freeman article is in the data folder.</p>

<p><a rel="nofollow" href="https://github.com/tricoders/texture-synthesis">https://github.com/tricoders/texture-synthesis</a></p>
]]></description>
   </item>
   <item>
      <title>Help in Visualization of Data</title>
      <link>https://forum.processing.org/two/discussion/10308/help-in-visualization-of-data</link>
      <pubDate>Tue, 14 Apr 2015 11:42:29 +0000</pubDate>
      <dc:creator>RifleGirl</dc:creator>
      <guid isPermaLink="false">10308@/two/discussions</guid>
      <description><![CDATA[<p>I want the images to scale slowly, given an array of values I have, when I click. I also want the text in the corner to change at the same time. What do I need to change in both my logic of this as well as the code to make this work?</p>

<pre><code>//Project in Visualization

void setup()
{
  size(700,700);
  smooth();
  USA = loadImage("map.png");
  bfly = loadImage("bfly.jpg");
}

void draw()
{
  background(255);
  image(USA,-160,-50,1000,880);
  for (int i = 0; i &lt; 4; i++)
  {
    if(mousePressed)
    {
      i++;
    //florida
    image(bfly,450,460,F[i],F[i]);
    //New England
    image(bfly,460,360,NE[i],NE[i]);
    //mexico
    image(bfly,280,540,M[i],M[i]);
    //north dakocta
    image(bfly,290,280,ND[i],ND[i]);
    }
  }
}

void mousePressed()
 {
   textSize(60);
   fill(0); 
   text("2000", 30, 600);
   noLoop();
 }

PImage USA;
PImage bfly;
</code></pre>
]]></description>
   </item>
   <item>
      <title>Loading an Image</title>
      <link>https://forum.processing.org/two/discussion/10293/loading-an-image</link>
      <pubDate>Mon, 13 Apr 2015 18:49:58 +0000</pubDate>
      <dc:creator>RifleGirl</dc:creator>
      <guid isPermaLink="false">10293@/two/discussions</guid>
      <description><![CDATA[<p>I am confused as to why this won't show an image.
map.png is in the folder of the project</p>

<pre><code>void setup()
{
  size(400,400);
  USA = loadImage("map.png");
}

void Draw()
{
  background(0);
  image(USA,400,400);
}

PImage USA;
</code></pre>
]]></description>
   </item>
   <item>
      <title>Twitter4j help: profile pictures</title>
      <link>https://forum.processing.org/two/discussion/10213/twitter4j-help-profile-pictures</link>
      <pubDate>Mon, 06 Apr 2015 20:35:54 +0000</pubDate>
      <dc:creator>chromeyellow</dc:creator>
      <guid isPermaLink="false">10213@/two/discussions</guid>
      <description><![CDATA[<p>I'm back again - sorry to be asking another question today - I'm having issues with getting the the user's profile picture to display in the drawing window.</p>

<p>Here's the full code:</p>

<pre><code>import twitter4j.util.*;
import twitter4j.*;
import twitter4j.management.*;
import twitter4j.api.*;
import twitter4j.conf.*;
import twitter4j.json.*;
import twitter4j.auth.*;

static String OAuthConsumerKey = "...";
static String OAuthConsumerSecret = "... ";
static String AccessToken = "...";
static String AccessTokenSecret = "... ";

String keywords[] = {"meaning of life"};

PImage bg;
int y;
TwitterStream twitterStream = new TwitterStreamFactory().getInstance();

void setup(){
  size(1920,1080);
  noStroke();
  connectTwitter();
  twitterStream.addListener(listener);

  size(1920, 1080);
 //bg = loadImage("twitterbackground.jpg");


  if (keywords.length==0){
    twitterStream.sample();
  }
  else{
    twitterStream.filter(new FilterQuery().track(keywords));
  }
}

//void draw() {
  //background(bg);

 // }



void connectTwitter() {
  twitterStream.setOAuthConsumer(OAuthConsumerKey, OAuthConsumerSecret);
  AccessToken accessToken = loadAccessToken();
  twitterStream.setOAuthAccessToken(accessToken);
}

// Loading up the access token
private static AccessToken loadAccessToken() {
  return new AccessToken(AccessToken, AccessTokenSecret);
}

StatusListener listener = new StatusListener(){
  public void onStatus(Status status){
    String tweets = status.getText();
    String user = "@" + status.getUser().getScreenName();
    tweets = user + " - " + tweets;
    println(tweets);


    status.getUser().getBiggerProfileImageURL(); 

    //ImageIcon = new ImageIcon(url);
    //Jlabel1.setIcon(img);

    text(status.getText(), random(width), random(height), 300, 200);
    text("@" + status.getUser().getScreenName(), random(width), random(height), 300, 200);



  }
  public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
    //System.out.println("Got a status deletion notice id:" + statusDeletionNotice.getStatusId());
  }
  public void onTrackLimitationNotice(int numberOfLimitedStatuses) {
    //  System.out.println("Got track limitation notice:" + numberOfLimitedStatuses);
  }
  public void onScrubGeo(long userId, long upToStatusId) {
    System.out.println("Got scrub_geo event userId:" + userId + " upToStatusId:" + upToStatusId);
  }

  public void onException(Exception ex) {
    ex.printStackTrace();
  }
  public void onStallWarning(StallWarning warning){

  }

};
</code></pre>

<p>This line isn't coming up with any errors:</p>

<pre><code>status.getUser().getBiggerProfileImageURL();
</code></pre>

<p>I've been looking at forums for hours trying everything I can find, and after that I have these two lines:</p>

<pre><code>    ImageIcon image = new ImageIcon(url);
    Jlabel1.setIcon(img);
</code></pre>

<p>Firstly it says "cannot find anything named "url". Then for the second line it says "Cannot find anything named "jlabel1". Am I missing a library or something?</p>

<p>Thank you so much - I know I'm probably making a very simple obvious mistake here.</p>
]]></description>
   </item>
   <item>
      <title>Applying filters to image sequences.</title>
      <link>https://forum.processing.org/two/discussion/10111/applying-filters-to-image-sequences</link>
      <pubDate>Mon, 30 Mar 2015 11:53:39 +0000</pubDate>
      <dc:creator>elliot</dc:creator>
      <guid isPermaLink="false">10111@/two/discussions</guid>
      <description><![CDATA[<p>I have some images sequences in a grid on the left side of my main program window. They are used as buttons to change the content in a viewing area which are also image sequences.</p>

<p>I have incorporated a fade so when I click on an image in my grid the current image sequence displayed in the viewing area fades out and the new content fades in. This fade occurs only on the viewing area section (called as 'area' below).</p>

<p>I have been wanting to add some filters to my program to add other effects however when I go though the same process to apply a filter as I did with the fade the filter shows up on the grid of images as well as the viewing area.</p>

<p>Here is a simplified version of my program.</p>

<pre><code>void draw() {
  for (int grid =0; grid&lt;content.length; grid++) {
  tint(255);
  content[grid].display();
  if (content[grid].clicked) {
  img=grid;
  alpha = 0;
}
 area[img].display(alpha, Slider);
} 
 pushMatrix();
 if (alpha&lt;255) {
 alpha += 10;
 } else {
 alpha = 0;
 }
 popMatrix();
 }
</code></pre>

<p>And here is the display part of my viewer class (called as area above).</p>

<pre><code>  void display(float alpha) {
  currentFrame = (currentFrame+1) % numFrames;
  tint(255, alpha);
  image(viewImages[(currentFrame) % numFrames], 504, 0);
  filter(POSTERIZE, Slider);
}
</code></pre>

<p>I have resolved my issue of  the filter showing up on the grid as well as the viewing area by changing this line 
"filter(POSTERIZE, 4);" with "viewImages[(currentFrame) % numFrames].filter(POSTERIZE, Slider);"</p>

<p>However now I am not calling image before view images. Therefore if the value of Slider changes it it not updated because I am not calling image again.</p>

<p>Is there a way to update the value of Slider even if I am still on the same image sequence?</p>

<p>Thanks.</p>
]]></description>
   </item>
   <item>
      <title>Raster image</title>
      <link>https://forum.processing.org/two/discussion/10089/raster-image</link>
      <pubDate>Sat, 28 Mar 2015 23:32:47 +0000</pubDate>
      <dc:creator>AudreyB</dc:creator>
      <guid isPermaLink="false">10089@/two/discussions</guid>
      <description><![CDATA[<p>Hello world! 
I'm trying to raster pictures from my webcam. Actually with this program, I have this kind of picture ( the first ).<img src="![]()" alt="" />
I wanna have more shades of grey (composed by dots), like the second one.</p>

<p>Could you help me, or redirected me to another discuss? i'm really lost...</p>

<p>Thanks!!</p>

<p>import processing.video.*;
import controlP5.*;</p>

<p>Capture cam;</p>

<p>ControlP5 cp5;
Slider abc;</p>

<p>float threshold = 75;</p>

<p>PImage destination;</p>

<p>int width_px = 320;
int height_px = 240;
int frame = 25;</p>

<p>int margin = 0;
int margin_left = 60;</p>

<p>void setup() {
  size(200, height_px);
  noStroke();
  cam = new Capture(this, width_px, height_px, frame);
  cam.start();
  destination = createImage(cam.width, cam.height, RGB);</p>

<p>cp5 = new ControlP5(this);</p>

<p>// add a vertical slider
  cp5.addSlider("threshold")
     .setPosition(0,0)
     .setSize(200,15)
     .setRange(0,200)
     .setValue(128)
     ;
}</p>

<p>void draw() {
  if(cam.available()) {
    cam.read();
  }
  cam.loadPixels();
  //image(cam, -margin_left ,margin);
  destination.loadPixels();</p>

<pre><code>for (int x = 0; x &lt; cam.width; x++) {
for (int y = 0; y &lt; cam.height; y++ ) {
  int loc = x + y*cam.width;
  // Test the brightness against the threshold
  if (brightness(cam.pixels[loc]) &gt; threshold) {
    destination.pixels[loc]  = color(255);  // White
  }  else {
    destination.pixels[loc]  = color(0);    // Black
  }
}
</code></pre>

<p>}</p>

<p>// We changed the pixels in destination
  destination.updatePixels();
  // Display the destination
  image(destination,-margin_left,margin);</p>

<p>if ( keyPressed ) {
  saveFrame("knit-####.png");
  }
}</p>

<p>void slider(float theThreshold) {
  threshold = theThreshold;
  //println("setting threshold to "+theColor);
}</p>

<p><img src="http://forum.processing.org/two/uploads/imageupload/128/SAMPWEV21XEX.png" alt="audrey" title="audrey" />
<img src="http://forum.processing.org/two/uploads/imageupload/140/RWWLY6RNJ7RB.jpg" alt="gisantfinal150" title="gisantfinal150" /></p>
]]></description>
   </item>
   <item>
      <title>Suggestion for a simple Photo Album</title>
      <link>https://forum.processing.org/two/discussion/10020/suggestion-for-a-simple-photo-album</link>
      <pubDate>Wed, 25 Mar 2015 01:47:45 +0000</pubDate>
      <dc:creator>HenrySmith</dc:creator>
      <guid isPermaLink="false">10020@/two/discussions</guid>
      <description><![CDATA[<p>Hi there,</p>

<p>I hope this post isn't too specific.</p>

<p>I am creating a simple application which consists of a Classic car album where the user can flip through various pages. However I am not sure what is the best and easiest way to display pictures of various size neatly on the sketch, one next to each other, similar to for example Google Image search results as shown below:</p>

<p><img src="http://forum.processing.org/two/uploads/imageupload/000/POMZFQOY8ALH.JPG" alt="ClassicCars" title="ClassicCars" /></p>

<p>Can someone recommend how this may be done or whether there exists any tools that can facilitate this task? I was thinking of splitting the sketch in equal grids and scaling each image to fit exactly in each box. However I am not sure if this is the best way to do it.</p>

<p>Any recommendations will be greatly appreciated!</p>
]]></description>
   </item>
   <item>
      <title>Arduino+processing Image transfer</title>
      <link>https://forum.processing.org/two/discussion/4064/arduino-processing-image-transfer</link>
      <pubDate>Mon, 31 Mar 2014 17:06:48 +0000</pubDate>
      <dc:creator>ep0490</dc:creator>
      <guid isPermaLink="false">4064@/two/discussions</guid>
      <description><![CDATA[<p>Hi all,</p>

<p>I found some codes online to use the arduino uno and processing to transfer one image through the Arduino serial port (TX and RX). I need to transfer 6 images. How can i modify the processing code or arduino code to be able to transfer all images one after the other. Example: transfer image 1, then 2 etc.</p>

<p>Below is the Arduinocode:</p>

<pre><code>     #include &lt;SD.h&gt;   

     File photoFile;   



     void setup(){   

      Serial.begin(115200);   



      //Serial.println("initializing sd card");   
      pinMode(10,OUTPUT);     // CS pin of SD Card Shield   

      if (!SD.begin(10)) {   
       Serial.print("sd initialzation failed");   
       return;   
      }   

     }   


     void loop(){   

      while(1){   

       Serial.flush();     




         File photoFile = SD.open("IMAGE09.jpg");   

         if (photoFile) {   
          while (photoFile.position() &lt; photoFile.size()) {   


           Serial.write(photoFile.read());   
          }   

          photoFile.close();   

         }    

         else {   
          Serial.println("error sending photo");   
         }         
        }   

       }   
      }   
</code></pre>

<p>PROCESSING CODE:
    // READ: Upload arduino code then processing.File
    //will be created in processiong library under my documets
    //
    //image will begin to transfer. . Click on 
    //the grey processing box AFTER complete imgae size
    // has been reached... and press any button. 
    //Image should have transferred.Click stop.</p>

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

Serial myPort;

OutputStream output;  
//OutputStream output2;

void setup() 
{  

  size(320, 240);  

  //println( Serial.list() );  
  myPort = new Serial( this, Serial.list()[0], 115200);  
  myPort.clear();  
  output = createOutput("IMAGE09.jpg");

}  


void draw() 
{  

  try {   
    while ( myPort.available () &gt; 0 ) 
    {  
      output.write(myPort.read());
    }
  }   
  catch (IOException e) {  
    e.printStackTrace();
  }
}  


void keyPressed()
{  
  try 
  {   
    output.flush(); // Writes the remaining data to the file 
    output.close();  // Finishes the file 
  }   

  catch (IOException e)
  {  
    e.printStackTrace();
  }
}    
</code></pre>
]]></description>
   </item>
   <item>
      <title>how to make a random image loop inside of an ellipse ?</title>
      <link>https://forum.processing.org/two/discussion/9630/how-to-make-a-random-image-loop-inside-of-an-ellipse</link>
      <pubDate>Sat, 28 Feb 2015 20:45:23 +0000</pubDate>
      <dc:creator>trukuluku</dc:creator>
      <guid isPermaLink="false">9630@/two/discussions</guid>
      <description><![CDATA[<p>Hello dear people! As many others, I'm also a beginner with Processing willing to execute certain idea and feeling helpless with that. 
The thing is following :</p>

<ol>
<li><p>I want to create a loop constantly displaying random images from a folder, one by one, one image on top of another.</p></li>
<li><p>All of them should be displayed inside of one unchanged ellipse.</p></li>
<li><p>The constant reappearance of new images should be stopped when mouse is clicked. For that moment you would see the last image that appeared before you clicked. When you stop pressing the mouse button, the random image display would continue.</p></li>
</ol>

<p>Here is what I've found to make the mask for an ellipse, but that is just one checkpoint. I still have no idea how to create that 'image lottery'.</p>

<pre><code>        PGraphics mask;
        PImage img;    

        void setup() {    
          img=loadImage("0.jpg");    
          img.resize(1000,0);    
            size(img.width,img.height);    
           background(40);    
          mask=createGraphics(width,height);//draw the mask object    
          mask.beginDraw();    
          mask.background(0);//background color to target    
          mask.fill(255);    
          mask.ellipse(width/2,height/2,500,500);    
          mask.endDraw();      
          img.mask(mask);     
         image(img,0,0);
        }
</code></pre>

<p>I will love you endlessly for your help!</p>
]]></description>
   </item>
   <item>
      <title>Set Application With and Height in Size() Based on the Background Image Width and Height</title>
      <link>https://forum.processing.org/two/discussion/9205/set-application-with-and-height-in-size-based-on-the-background-image-width-and-height</link>
      <pubDate>Tue, 27 Jan 2015 18:20:47 +0000</pubDate>
      <dc:creator>Persis</dc:creator>
      <guid isPermaLink="false">9205@/two/discussions</guid>
      <description><![CDATA[<p>Say have a background image named img. I get exceptions when I do : size(int(img.width), int(img.height));</p>

<p>Is there a way I can automatically set the size of the application window based on the background image W and H?</p>

<p>FYI, background is a PShape stored in an SVG file.</p>
]]></description>
   </item>
   <item>
      <title>Puzzle Transition</title>
      <link>https://forum.processing.org/two/discussion/8113/puzzle-transition</link>
      <pubDate>Wed, 12 Nov 2014 18:21:22 +0000</pubDate>
      <dc:creator>Mtre</dc:creator>
      <guid isPermaLink="false">8113@/two/discussions</guid>
      <description><![CDATA[<p>Hi I am a high school senior with very little experience using processing. I was wondering using this code below(found it), instead of having a mixed image as a result, it will create another image I can input; like a transition. Is it possible? After another image appears, it will slowly appear the main menu screen.. then to the interactive program.</p>

<p>I truly appreciate your help!</p>

<p>Puzzle code:
<a href="http://www.openprocessing.org/sketch/74233" target="_blank" rel="nofollow">http://www.openprocessing.org/sketch/74233</a></p>
]]></description>
   </item>
   </channel>
</rss>