<?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 datapath() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=datapath%28%29</link>
      <pubDate>Sun, 08 Aug 2021 18:41:17 +0000</pubDate>
         <description>Tagged with datapath() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggeddatapath%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Can I use f = open('text', 'w') with processing?</title>
      <link>https://forum.processing.org/two/discussion/27767/can-i-use-f-open-text-w-with-processing</link>
      <pubDate>Sun, 15 Apr 2018 04:32:55 +0000</pubDate>
      <dc:creator>netrate</dc:creator>
      <guid isPermaLink="false">27767@/two/discussions</guid>
      <description><![CDATA[<p>I was looking at the writing to a text file using python/processing and noticed that there is something called: "createWriter".  Is this the only way?  I am used to using: 
<code>open("text", "w")</code> 
After several attempts at using "open", I couldn't get it to create the text file BUT, for some reason:
<code>open("text", "r")</code>
seems to work.</p>

<p>Here is my code :
  <code>f = open('text.txt', 'w')
    f.write("hello")
    f.close()
    noLoop()</code></p>

<p>If I have to use CreateWriter, I will, but I was wondering why the "r" works, but the "w" does not?</p>
]]></description>
   </item>
   <item>
      <title>How to load and save table on android without error "File contains a path separator"?</title>
      <link>https://forum.processing.org/two/discussion/25419/how-to-load-and-save-table-on-android-without-error-file-contains-a-path-separator</link>
      <pubDate>Wed, 06 Dec 2017 19:14:02 +0000</pubDate>
      <dc:creator>Night</dc:creator>
      <guid isPermaLink="false">25419@/two/discussions</guid>
      <description><![CDATA[<p>Hey!
I'm trying to develop an app on android with processing that needs to save information in a table for next time use and then retrieve it later on.  (Sort of like a leaderboard record).  The problem is that saveTable() and loadTable() don't work because the error java.lang.IllegalArgumentException: File contains a path separator is returned.
Here is bascially what I'm trying to do (Which works fine on normal PC):
In setup:</p>

<p><code>try {
    PersonalDetails = loadTable("AccountInfo.csv", "header");      // PersonalDetails is my table variable.
    if (PersonalDetails.getRowCount() &gt; 0) {
      Registered = true;
      LocalScore = PersonalDetails.getRow(0).getInt("Score");
    }
  } 
  catch (NullPointerException e) {
    Table createCSV = new Table();
    createCSV.addColumn("ID", Table.INT);
    createCSV.addColumn("Score", Table.INT);
    createCSV.addColumn("Name", Table.STRING);
    saveTable(createCSV, "data/AccountInfo.csv");
    PersonalDetails = loadTable("AccountInfo.csv", "header");
    if (PersonalDetails.getRowCount() &gt; 0) {
      Registered = true;
      LocalScore = PersonalDetails.getRow(0).getInt("Score");
    }
  }</code></p>

<p>And then in draw basically continuously save as score updates:</p>

<p><code>void draw() {
  if (Start) {
    if (Registered) {
      PersonalDetails.setInt(0, "Score", LocalScore);
      saveTable(PersonalDetails, "data/AccountInfo.csv");
    }
  }
  background(255);
}</code></p>

<p>As for android I continued to get the error stated above.  I've tried multiple solutions to try to fix this including an InputStream and BufferedReader, this read the file perfectly fine:</p>

<p><code>BufferedReader br;
String line;
void readInfo() {
  try {
    InputStream is = createInput("AccountInfo.txt");
    br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
    while ((line=br.readLine())!=null) {
      System.out.println(line);
    }
  }
  catch (IOException e) {
    System.out.println("IOException when trying to read AccountInfo.txt:\n"+e);
    System.exit(0);
  }
}</code></p>

<p>But, every approach i've taken so far to try to write the file failed.  I'm assuming read works better because it will auto search the /files/ directory when not specified with a path.  So far i've tried to use a BufferedWriter and PrintWriter in the same way as readInfo() above, hoping it would work, but it didn't:</p>

<p><code>PrintWriter saveInformation;
BufferedWriter writer = null;
void saveInfo() {
  try
  {
    writer = new BufferedWriter(new FileWriter("accountinfo.csv"));
    saveInformation = new PrintWriter("accountinfo.csv");
    saveInformation.println("Changed Text File...");
    writer.write("Changed Text file...");
  }
  catch ( IOException e)
  {
  }
  finally
  {
    try
    {
      if ( writer != null )  writer.close( );
      if (saveInformation != null)  saveInformation.close();
    }
    catch ( IOException e)
    {
    }
  }
}</code></p>

<p>I have also tried to use the AssetManager, couldn't get that working.  Also, I tried to use all above listed methods with relative file path and absolute file path.  Each of these would similarly return the same error  "java.lang.IllegalArgumentException: File contains a path separator".</p>

<p>Any help or feedback on the matter would be immensely very much greatly incredibly much appreciated!</p>
]]></description>
   </item>
   <item>
      <title>data format of dataPath</title>
      <link>https://forum.processing.org/two/discussion/25994/data-format-of-datapath</link>
      <pubDate>Tue, 16 Jan 2018 15:20:52 +0000</pubDate>
      <dc:creator>gellpro</dc:creator>
      <guid isPermaLink="false">25994@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>Isn't the format of dataPath String?
Although I wrote the following code, but A wasn't called.
Why isn't the println("A") called?</p>

<p>String data_path = dataPath("test");
if(data_path == dataPath("test")) {
    println("A");
}
else {
   println("B");
}</p>

<p>Best regards,
gellpro</p>
]]></description>
   </item>
   <item>
      <title>Where to put a jpg using BlueJ</title>
      <link>https://forum.processing.org/two/discussion/25490/where-to-put-a-jpg-using-bluej</link>
      <pubDate>Sun, 10 Dec 2017 09:09:47 +0000</pubDate>
      <dc:creator>teachFun</dc:creator>
      <guid isPermaLink="false">25490@/two/discussions</guid>
      <description><![CDATA[<p>Hi everybody,
since this year, I'm using BlueJ and processing to teach my students the java basics. I use BlueJ because later that year they have to use it for other projects. I put the processing "core.jar" in a folder wich is named "+libs" in my BlueJ project folder - no problem. 
But where do I have to put an image like "bild1.jpg" so it is found by processing. I tried to put it inside the BlueJ-project folder, inside the +libs-folder. I tried using "bild1.jpg", "./bild1.jpg", ".\bild1.jpg" . Everytime I got a Null pointer exception when using "image(img,0,0)".
Thanks in advance for every hint, Ingo</p>
]]></description>
   </item>
   <item>
      <title>How to delete an image?</title>
      <link>https://forum.processing.org/two/discussion/24014/how-to-delete-an-image</link>
      <pubDate>Sun, 03 Sep 2017 16:17:09 +0000</pubDate>
      <dc:creator>first</dc:creator>
      <guid isPermaLink="false">24014@/two/discussions</guid>
      <description><![CDATA[<p>Dear friends, I have designed an image and save it in my sketch folder. I want to delete this image from the sketch folder
after an event such as mouse pressed. Can anyone suggest me how to delete an image from sketch?</p>
]]></description>
   </item>
   <item>
      <title>How to use random to get at my color array</title>
      <link>https://forum.processing.org/two/discussion/23896/how-to-use-random-to-get-at-my-color-array</link>
      <pubDate>Wed, 23 Aug 2017 03:18:50 +0000</pubDate>
      <dc:creator>Petros</dc:creator>
      <guid isPermaLink="false">23896@/two/discussions</guid>
      <description><![CDATA[<p>What I'm trying to do: create a bunch of ellipses (in a grid) that each have one of an array of colors and that each mask one or more rectangles that also have a variable color from the same array. I've succeeded at (1) creating a masked shape, (2) duplicating it in a grid, and (3) creating an array of colors. Right now I'm trying to get that array to affect the colors but I'm failing. What am I doing wrong? I'm getting an error "expecting EOF, found 'colorset'." Pretty sure I have my file set up incorrectly. Any tips?</p>

<pre><code>/**
 * Draw rectangles inside of circles
 * 2017-08-22
 **/
PGraphics sourceImage;
PGraphics maskImage;

  int colorset;
  color [] colorsetarray = { 
    color(#3AC459), 
    color(#3D8CFF), 
    color(#8CD6ED), 
    color(#F7CC68), 
    color(#F77068), 
    color(#576984), 
    color(#7A9BB0), 
    color(#D8E8ED), 
    color(#EAF4F7) };
  colorset = colorsetarray[(int)random(0, 8)];

void setup() {
  size(800, 800); //size of canvas
  noLoop();
  smooth();
}

void draw() {

  for (int y = 20; y &lt; height-8; y += 120) {
    for (int x = 20; x &lt; width-80; x += 120) {
      // create source
      sourceImage = createGraphics(100, 100); //size of drawing
      sourceImage.beginDraw();
      sourceImage.background(colorsetarray[(int)random(colorsetarray.length)]); //color the background
      sourceImage.fill(colorsetarray[(int)random(colorsetarray.length)]); //color the rectangle
      sourceImage.translate(width/2, height/2);
      sourceImage.rotate(radians(45));
      sourceImage.noStroke(); //take the stroke off of the rectangle
      sourceImage.rect(-600, -200, 80, 500); //locate the rectangle and draw it
      sourceImage.endDraw();

      // create mask
      maskImage = createGraphics(100, 100); //size of mask
      maskImage.beginDraw();
      maskImage.ellipse(50, 50, 100, 100);
      maskImage.endDraw();

      // apply mask
      sourceImage.mask(maskImage);

      // show masked source
      image(sourceImage, x, y); //move the chip here
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Executing python 3 code from within processing</title>
      <link>https://forum.processing.org/two/discussion/23324/executing-python-3-code-from-within-processing</link>
      <pubDate>Wed, 05 Jul 2017 17:16:27 +0000</pubDate>
      <dc:creator>daddydean</dc:creator>
      <guid isPermaLink="false">23324@/two/discussions</guid>
      <description><![CDATA[<p>Hello!<br />
I'd like to integrate this code which is written in Python into my current code but im not sure how to go about it since the script is in Python 3:<br />
<a href="https://github.com/alex-parker/CenturyOfTheSun/pull/1/commits/ed50abc1dce0f88e4e517109910bc4d52dbd6079?diff=unified" target="_blank" rel="nofollow">https://github.com/alex-parker/CenturyOfTheSun/pull/1/commits/ed50abc1dce0f88e4e517109910bc4d52dbd6079?diff=unified</a><br />
Is there a way I could execute this script using processing?<br />
I know Jython only supports up to 2.7, so im trying to find a workaround.<br />
:)</p>
]]></description>
   </item>
   <item>
      <title>How to save files to the data folder without needing an absolute path.</title>
      <link>https://forum.processing.org/two/discussion/18130/how-to-save-files-to-the-data-folder-without-needing-an-absolute-path</link>
      <pubDate>Sat, 10 Sep 2016 19:05:11 +0000</pubDate>
      <dc:creator>rickhatfield</dc:creator>
      <guid isPermaLink="false">18130@/two/discussions</guid>
      <description><![CDATA[<p>OK, maybe I'm making a big deal over nothing, I'm fairly new to Processing but --
loadStrings() expects to load a user-defined file from the current sketch's "data" folder , right?
But saveStrings() does not SAVE to that folder, it goes out to the main sketch folder.
SO if you want your program to load a file, modify it, and then resave it back to the data folder, you are forced to use an absolute path for saving, thus  kinda blowing your portability, or at least forcing you to write a custom file saving routine.
Am i wrong about this?  Is there some easy way to direct your Sketch to actually save your data to the data forder?
And if not, why the heck not?  Is there some point to doing it this way?</p>
]]></description>
   </item>
   <item>
      <title>launch() not running all parameters or not running at all</title>
      <link>https://forum.processing.org/two/discussion/17798/launch-not-running-all-parameters-or-not-running-at-all</link>
      <pubDate>Tue, 09 Aug 2016 07:44:12 +0000</pubDate>
      <dc:creator>luckyfellow</dc:creator>
      <guid isPermaLink="false">17798@/two/discussions</guid>
      <description><![CDATA[<p>launch() does not seem to be passing all parameters to lame.exe. As you can see in the comments, one version ignores the quality settings (not useful). The other versions don't even run.</p>

<pre><code>String mode;
float Vnumber;
String pathToLame;

void setup() {
  size(200, 200);
  mode = "m";
  Vnumber = 0;
  pathToLame = dataPath("lame.exe");
}

void draw() { 
  // draw() must be present for mousePressed() to work
}

void mousePressed() {

  \\ignores "-q 0 -p -m m -V 5"
  String[] params = { pathToLame, "-q 0 -p -m m -V 5", "C:\\Users\\Avis\\Desktop\\test2.wav", "C:\\Users\\Avis\\Desktop\\test5.mp3" };

  \\doesn't even run...
  String[] params = { pathToLame, "-q 0", "-p", "-m m", "-V 5", "C:\\Users\\Avis\\Desktop\\test2.wav", "C:\\Users\\Avis\\Desktop\\test5.mp3" };

 \\ also doesn't run...
 String[] params = { pathToLame, "-q 0 -p -m m -V 5 C:\\Users\\Avis\\Desktop\\test4.wav C:\\Users\\Avis\\Desktop\\test4.mp3" };
  launch(params);
  println(params);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Loading a specific file.</title>
      <link>https://forum.processing.org/two/discussion/17652/loading-a-specific-file</link>
      <pubDate>Tue, 26 Jul 2016 14:49:29 +0000</pubDate>
      <dc:creator>Skylarrr7</dc:creator>
      <guid isPermaLink="false">17652@/two/discussions</guid>
      <description><![CDATA[<p>I have been trying to use the dataPath() to find a file, which it works but when i try to load the file and display it, it wont work.
I've tried using " File file = new File(dataPath("save.txt")); " with " if(file.exists()){} " but that doesn't work. Please tell me what I am doing wrong. I really want to get this working before i just give up on it and put it off.</p>
]]></description>
   </item>
   <item>
      <title>sketchPath is not visible (3.0a9)</title>
      <link>https://forum.processing.org/two/discussion/11162/sketchpath-is-not-visible-3-0a9</link>
      <pubDate>Fri, 05 Jun 2015 10:35:46 +0000</pubDate>
      <dc:creator>kowalski5233</dc:creator>
      <guid isPermaLink="false">11162@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys.</p>

<p>I'm playing with the 3.0a versions and have been using 5 for a while and upgraded to 9 after a format.  I see quite a lot has changed (awesome!), but am finding some things not working.  I hope I did enough research before posting here.</p>

<p>I'm using 'sketchPath' to determine the path of the sketch to open some files in my data folder<br />
<code>String UBUPFile = sketchPath + "/data/UBUP.bin";</code><br />
Where this has been working fine up until 3.0a5, in a9 it produces the following error<br />
<code>The field PApplet.sketchPath is not visible</code><br />
There doesn't seem to be anything in the revisions.txt, unless I missed something</p>
]]></description>
   </item>
   <item>
      <title>Where does my sketch save/load files from when run from IntelliJ?</title>
      <link>https://forum.processing.org/two/discussion/16701/where-does-my-sketch-save-load-files-from-when-run-from-intellij</link>
      <pubDate>Thu, 19 May 2016 14:14:03 +0000</pubDate>
      <dc:creator>camb416</dc:creator>
      <guid isPermaLink="false">16701@/two/discussions</guid>
      <description><![CDATA[<p>Hi all,</p>

<p>I've followed <a rel="nofollow" href="https://github.com/camb416/tech-tutorials/tree/master/processing-intellij"><strong>these steps</strong></a> in creating Processing 3 sketches in IntelliJ. I would now like to use <code>saveFrame()</code> to export images from my sketch, but I have no idea where the frames are saved to. Related to this, if I wanted to load an image file, where would I place it in my project?</p>

<p>Thanks in advance!</p>
]]></description>
   </item>
   <item>
      <title>How to save an image in other folder ?</title>
      <link>https://forum.processing.org/two/discussion/16548/how-to-save-an-image-in-other-folder</link>
      <pubDate>Wed, 11 May 2016 19:44:09 +0000</pubDate>
      <dc:creator>VTT85</dc:creator>
      <guid isPermaLink="false">16548@/two/discussions</guid>
      <description><![CDATA[<p>Hi all !</p>

<p>I've a question, How to save an image in other folder than the root folder please ?</p>

<p>Thank you all :)</p>
]]></description>
   </item>
   <item>
      <title>PImage.save() not working?</title>
      <link>https://forum.processing.org/two/discussion/16399/pimage-save-not-working</link>
      <pubDate>Tue, 03 May 2016 09:57:23 +0000</pubDate>
      <dc:creator>RaulF</dc:creator>
      <guid isPermaLink="false">16399@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I'm trying to save a PImage and I'm getting the famous "PImage.save() requires an absolute path...".
The PImage.save() code reference doesn't work either.</p>

<pre><code>size(100, 100);
PImage tower = loadImage("tower.jpg");
PImage newImage = createImage(100, 100, RGB);
newImage = tower.get();
newImage.save("outputImage.jpg");
</code></pre>

<p>Any idea? It should work. I'm working with the last version, and Mac OSX.</p>

<p>thanks!</p>
]]></description>
   </item>
   <item>
      <title>Problems with saving strings to file</title>
      <link>https://forum.processing.org/two/discussion/16174/problems-with-saving-strings-to-file</link>
      <pubDate>Thu, 21 Apr 2016 19:01:26 +0000</pubDate>
      <dc:creator>AmyM</dc:creator>
      <guid isPermaLink="false">16174@/two/discussions</guid>
      <description><![CDATA[<p>Im having problems saving a string to a txt file. The file.txt is in the data folder. I'm not sure what I am doing wrong.</p>

<pre><code>else if (hb0.value &gt;= hb0.max) {
        frameNum++;

        image(images[frameNum/10 %images.length], 800, 600);     

        port.write(1); 


        println("Here is the achievment"); 
        image(achievment2, 700, 100);
        String words = "Achievement achieved";
        String[] list = split(words , " ");

        saveStrings("file.txt", list);
        println("They are saved");
</code></pre>
]]></description>
   </item>
   <item>
      <title>Add 0's to date/time in the filename with saveFrame()</title>
      <link>https://forum.processing.org/two/discussion/16001/add-0-s-to-date-time-in-the-filename-with-saveframe</link>
      <pubDate>Wed, 13 Apr 2016 11:57:04 +0000</pubDate>
      <dc:creator>bhuhnke</dc:creator>
      <guid isPermaLink="false">16001@/two/discussions</guid>
      <description><![CDATA[<p>Hey there! 
This is my first post here, already found a lot of helpful stuff here just reading.
I was just wondering if this is something I'm doing wrong or if it is not intended.</p>

<p>When I use saveFrame() to save a projects current canvas, I usually wanna have this result:
Projectname-20161230-184555.png which usually corresponds to following line:</p>

<p><code>saveFrame(Project+"-"+year()+month()+day()+"-"+hour()+minute()+second()+".png");</code></p>

<p>(yes, I'm from Europe, I like my months in front of my days :P)</p>

<p>The only real issue is that every function returns exactly what it is supposed to (which is totally right):
When it is 8 am for example it returns an 8 when I call hour(). If I want to auto-sort the files though I need the 0 in front of every digit that doesnt have 2 digits, so I came up with this (quite hacky) solution (titled as void savePNG() because it isn't a one-liner anymore so I can call it):</p>

<pre><code>void savePNG() {
  if (second()&lt;10) {
    saveFrame(Project+"-"+year()+month()+day()+"-"+hour()+minute()+"0"+second()+".png");
  } else if (minute()&lt;10) {
    saveFrame(Project+"-"+year()+month()+day()+"-"+hour()+"0"+minute()+second()+".png");
  } else if (hour()&lt;10) {
    saveFrame(Project+"-"+year()+month()+day()+"-"+"0"+hour()+minute()+second()+".png");
  } else if (minute()&lt;10 &amp;&amp; second()&lt;10) {
    saveFrame(Project+"-"+year()+month()+day()+"-"+hour()+"0"+"0"+minute()+"0"+second()+".png");
  } else if (second()&lt;10 &amp;&amp; hour()&lt;10) {
    saveFrame(Project+"-"+year()+month()+day()+"-"+"0"+hour()+minute()+"0"+second()+".png");
  } else if (minute()&lt;10 &amp;&amp; hour()&lt;10) {
    saveFrame(Project+"-"+year()+month()+day()+"-"+"0"+hour()+"0"+minute()+second()+".png");
  } else if (second()&lt;10 &amp;&amp; minute()&lt;10 &amp;&amp; hour()&lt;10) {
    saveFrame(Project+"-"+year()+month()+day()+"-"+"0"+hour()+"0"+minute()+"0"+second()+".png");
  } else {
    saveFrame(Project+"-"+year()+month()+day()+"-"+hour()+minute()+second()+".png");
  }
}
</code></pre>

<p>And yes, I forgot about months and days here aswell.</p>

<p>Is there an easier way or is that just the way it's supposed to be?</p>
]]></description>
   </item>
   <item>
      <title>Launch .exe from Processing sketch in Windows 10</title>
      <link>https://forum.processing.org/two/discussion/15958/launch-exe-from-processing-sketch-in-windows-10</link>
      <pubDate>Mon, 11 Apr 2016 00:12:33 +0000</pubDate>
      <dc:creator>Prymitywista</dc:creator>
      <guid isPermaLink="false">15958@/two/discussions</guid>
      <description><![CDATA[<p>Hi there, I want to make a launchscreen which could open another .exe (a game).
But when I use Launch command, nothing happen.</p>

<pre><code>   if (keyCode == ENTER){ //&lt;&gt;//
    open(dataPath("game.exe")); 
</code></pre>

<p>exit();</p>

<p>neither this one:</p>

<pre><code>  if (keyCode == ENTER){ //&lt;&gt;//
   launch(dataPath("game.exe")); 
</code></pre>

<p>exit();</p>

<p>On mac and processing 2.0, open(dataPatch()) work perfect. On W10 I can't do that on any way even using Processing 2.0, 3.0, open or launch command.</p>

<p>I hope anyone know how to fix that... thanks a lot...!</p>
]]></description>
   </item>
   <item>
      <title>loading resources within alternative IDE</title>
      <link>https://forum.processing.org/two/discussion/15699/loading-resources-within-alternative-ide</link>
      <pubDate>Sat, 26 Mar 2016 16:46:00 +0000</pubDate>
      <dc:creator>ARGB</dc:creator>
      <guid isPermaLink="false">15699@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I am moving to IntelliJ with my Processing projects and and right now I am desperatly trying to load a .vlw-File into my Application within my extended PApplet-Class. Using the Processing-IDE, all I had to do was creating the data folder and loading the Font with the loadFont-method. But now I have to locate the data folder myself which did not work right now for me. 
Where the heck do I have to place it?</p>

<p>Thanks!</p>
]]></description>
   </item>
   <item>
      <title>Strange problem with image/graphic not being found/created on linux</title>
      <link>https://forum.processing.org/two/discussion/15431/strange-problem-with-image-graphic-not-being-found-created-on-linux</link>
      <pubDate>Fri, 11 Mar 2016 09:14:10 +0000</pubDate>
      <dc:creator>not55</dc:creator>
      <guid isPermaLink="false">15431@/two/discussions</guid>
      <description><![CDATA[<p>Can anyone help with this please?</p>

<p>In main project file:</p>

<pre><code>Map map;

void setup(){
...
map = new Map();
...
}
</code></pre>

<p>In Map's constructor, where (members) pgMap is a PGraphic and imgMap is a PImage, I create a graphic draw some stuff on it, save it out then reload it as an image:</p>

<pre><code>...
//save to file
pgMap.save("map.png");

//re-load as an image
imgMap = loadImage("map.png");
...
}
</code></pre>

<p>Another of Map's methods:</p>

<pre><code>void renderWorld() {
    image(imgMap, 0, 0);
}
</code></pre>

<p>If I call map.renderWorld() from draw() I get a null pointer/"map.png" not found error <strong>and</strong> sure enough map.png hasn't been created. If I comment out the single line in renderWorld() the map gets created normally and the program functions as expected!</p>

<p>I suspected a path issue but I've tried no path (as above), using a relative path to ./data and using an explicit path to /data but none of those work. A separate image used by the program stored in ./data loads from setup() without any path being specified:</p>

<p><code>loadImage("compass.jpeg");</code></p>

<p>I've also tried loading Map's image from setup(), rather than within the constructor like so:</p>

<p><code>map.imgMap = loadImage("map.png");</code></p>

<p>but that doesn't work either (also tried specifiying paths at that point).</p>

<p>This is on Linux Mint 32 bit with Processing 3.0.2, any help appreciated!</p>
]]></description>
   </item>
   <item>
      <title>Reading textfiles/images from directory</title>
      <link>https://forum.processing.org/two/discussion/14985/reading-textfiles-images-from-directory</link>
      <pubDate>Thu, 18 Feb 2016 06:39:33 +0000</pubDate>
      <dc:creator>atran</dc:creator>
      <guid isPermaLink="false">14985@/two/discussions</guid>
      <description><![CDATA[<p>Hi I was just wondering how I would approach loading text files and images from different directories in processing? I tried using loadImage() and loadTable(), which only works if the files are in the sketch folder's root directory or a data folder inside the sketch folder. It doesn't seem to work if I have different folders inside sketch folder. They say the files do not exist.</p>

<p>Thank you</p>
]]></description>
   </item>
   <item>
      <title>Creating Tables</title>
      <link>https://forum.processing.org/two/discussion/14756/creating-tables</link>
      <pubDate>Thu, 04 Feb 2016 11:42:16 +0000</pubDate>
      <dc:creator>rodrigolebrun</dc:creator>
      <guid isPermaLink="false">14756@/two/discussions</guid>
      <description><![CDATA[<p>Hi everyone.
So I'm now entering the world of creating, fetching and parsing data. Very very early stages at the moment and I'm already sweating. My task was to create a table that would save mouseX and mouseY data onto a table of max 10 lines. Pretty simple, pretty straight forward, but it doesn't work. I spent quite a good deal of time trying to understand why, iterating but I keep on getting the same error: "Array  index out of range:0" ... Help?
Here's the code. Thanks!</p>

<pre><code>Table table;
int counter=0;

void setup() {
  size(); 
  table= new Table();
  table.addColumn("id", Table.INT);
  table.addColumn("valueX", Table.INT);
  table.addColumn("valueY", Table.INT);
  saveTable(table, "data/new.csv");
}


void draw() {
  TableRow row=table.addRow();
  row.setInt("id", counter);
  row.setInt("valueX", mouseX);
  row.setInt("valueY", mouseY);

  counter++;



  //if (table.getRow()&gt;10) {
  //  table.removeRow(0);


  //}
}

void mousePressed() {
  exit();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Need Help!! Pgraphics Clear() does not work well in my code..</title>
      <link>https://forum.processing.org/two/discussion/14166/need-help-pgraphics-clear-does-not-work-well-in-my-code</link>
      <pubDate>Sun, 27 Dec 2015 21:17:59 +0000</pubDate>
      <dc:creator>DongY</dc:creator>
      <guid isPermaLink="false">14166@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I'm new here and very pleasured to be at a minimun level to ask a question understanding Processing codes (&gt;.&lt;)V.
I'm making an interactive drawing tool to save one's own alphabet types(.png) with a transparent background.
But I have a problem to clear the previous type to draw a new type after using PGrphics...
I've found lots of references for this but I couldn't find a solution to clean the type written.</p>

<p>Maybe for someone it's a simple to solve this problem, I hope your help please~!!</p>

<p>Thank you for your help in advance :)</p>

<hr />

<p>Here's my code for it :</p>

<p>PGraphics alphaG;</p>

<p>float med_mouseX=mouseX;</p>

<p>float med_mouseY=mouseY;</p>

<p>void setup() {</p>

<p>size(400, 500);
  background(255);
  smooth();
  frameRate(30);
  alphaG = createGraphics(width, height);
}</p>

<p>void draw() {
  alphaG.beginDraw();</p>

<p>if (mousePressed) {</p>

<pre><code>//draw an alphabet type
//alphaG.noStroke();
med_mouseX=mouseX+random(-5, 30);
med_mouseY=mouseY+random(-5, 30);
alphaG.stroke(255);
alphaG.strokeWeight(random(20, 60));
alphaG.strokeCap(ROUND);
alphaG.stroke(0, random(0, 255), random(0, 255));
alphaG.line(mouseX, mouseY, pmouseX, pmouseY);
alphaG.endDraw();
image(alphaG, 0, 0);
</code></pre>

<p>}
}</p>

<p>void keyPressed() {
//clear a type written 
  if (key == BACKSPACE) {
    alphaG.clear();
  }
//save an alpha written with keyboard(this code can be shorter? ^^?)
  if (key=='a') {
    String fileName = "data/"+"a"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='b') {
    String fileName = "data/"+"b"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='c') {
    String fileName = "data/"+"c"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='d') {
    String fileName = "data/"+"d"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='e') {
    String fileName = "data/"+"e"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='f') {
    String fileName = "data/"+"f"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='g') {
    String fileName = "data/"+"g"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='h') {
    String fileName = "data/"+"h"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='i') {
    String fileName = "data/"+"i"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='j') {
    String fileName = "data/"+"j"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='k') {
    String fileName = "data/"+"k"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='l') {
    String fileName = "data/"+"l"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='m') {
    String fileName = "data/"+"m"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='n') {
    String fileName = "data/"+"n"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='o') {
    String fileName = "data/"+"o"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='p') {
    String fileName = "data/"+"p"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='q') {
    String fileName = "data/"+"q"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='r') {
    String fileName = "data/"+"r"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='s') {
    String fileName = "data/"+"s"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='t') {
    String fileName = "data/"+"t"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='u') {
    String fileName = "data/"+"u"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='v') {
    String fileName = "data/"+"v"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='w') {
    String fileName = "data/"+"w"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='x') {
    String fileName = "data/"+"x"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='y') {
    String fileName = "data/"+"y"+"1"+".png";
    alphaG.save(fileName);
  }</p>

<p>if (key=='z') {
    String fileName = "data/"+"z"+"1"+".png";
    alphaG.save(fileName);
  }
}</p>
]]></description>
   </item>
   <item>
      <title>Arrayliste mit einem String vergleichen</title>
      <link>https://forum.processing.org/two/discussion/14017/arrayliste-mit-einem-string-vergleichen</link>
      <pubDate>Wed, 16 Dec 2015 13:21:58 +0000</pubDate>
      <dc:creator>malerlein</dc:creator>
      <guid isPermaLink="false">14017@/two/discussions</guid>
      <description><![CDATA[<p>Hallo zusammen.
ich möchte gerne eine Arrayliste mit einem String vergleichen. In meinem Programm wird eine Kunden Nr. in einer Arreyliste eingetragen, diese möchte ich gerne beim eingeben einer Alten oder Neuen Kunden Nr. mit der Liste vergleichen ob sie schon vorhanden ist oder neu angelegt werden muss. Meine Daten im Programm werden inkl. der Adress Daten gespeichert und ich möchte gerne wenn ich eine Kunden Nummer eingebe überprüfen ob der Kunde schon vorhanden ist oder neu ist. wenn er vorhanden ist sollen auf Grund der Kunden Nr. worunter der Kunde gespeichert ist die Daten geladen und angezeigt werden. Wenn er neu ist der Kunde soll ein Adressfeld geöffnet werden und die Adresse dann gespeichert werden. Ich komme aber mit der ArrayList nicht zu Potte. Da ich in den Referenzen nicht ersehe wie ich es anstellen muss um zu vergleichen. Ich habe einmal ein Sketch schnipsel angehangen wie ich es gedacht habe, aber so klappt das nicht.</p>

<pre><code>void adressfelder(){

    textFont (TEXT, 12);
    text(kdnr,770,100);// das ist die eingegebene kdnr
    ad5 = new ArrayList();

    if (ad5.equals(kdnr) == false) {
        ad5.add(kdnr);// vergleich Anfang
    } else {
        String merker[] = loadStrings("Kunden/"+kdnr+"/"+kdnr+" einstellungen.txt");
        textFont (TEXT, 12);
        text(kdnr,770,100);  
        textFont (TEXT, 16);
        text(ad1,770,135); // Adress Ausgabe
        text(ad2,770,175); 
        text(ad3,770,215);
        text(ad4,770,255); 
        text("gleich"+kdnr,250,70);// test ob wahr oder unwahr
    }
}
</code></pre>

<p>Ich hoffe Ihr versteht wie ich das meine.......</p>
]]></description>
   </item>
   <item>
      <title>how to Add video or image, help me!</title>
      <link>https://forum.processing.org/two/discussion/13991/how-to-add-video-or-image-help-me</link>
      <pubDate>Tue, 15 Dec 2015 16:11:55 +0000</pubDate>
      <dc:creator>danglove_113</dc:creator>
      <guid isPermaLink="false">13991@/two/discussions</guid>
      <description><![CDATA[<p>void setup() {
    size(displayWidth, displayHeight);
    theMov = new Movie(this, "video1.mov");
    theMov2 = new Movie(this, "video2.mov");
    theMov3 = new Movie(this, "video3.mov");
    theMov4 = new Movie(this, "vid1o4.mov");
}</p>

<p>i don't know how to add video or image like in code?
error: Could not load movie file video1.mov</p>
]]></description>
   </item>
   <item>
      <title>PImage.resize problem</title>
      <link>https://forum.processing.org/two/discussion/13944/pimage-resize-problem</link>
      <pubDate>Sun, 13 Dec 2015 18:18:02 +0000</pubDate>
      <dc:creator>ch3</dc:creator>
      <guid isPermaLink="false">13944@/two/discussions</guid>
      <description><![CDATA[<p>in javaScript mode of processing 2.2.1, the resize function breaks my sketch.</p>

<pre><code>    /* <a href="/two/profile/pjs">@pjs</a> preload="../georgios.jpg"; */
PImage img;

void setup() {
  //size(800,800, RGB);
  size(800,800, P2D);
  colorMode(RGB,1);
  background(0);
  //frameRate(60);
  img = loadImage("../georgios.jpg");
  img.resize(100, 100);
}

void draw() {
  background(0);
  image(img, 0, 0);
}
</code></pre>

<p>Strange thing is that if I comment out the framerate it displays the image but at the original size.</p>

<p>there has been another post about this, but no answer. Any ideas maybe?
Thank you</p>
]]></description>
   </item>
   <item>
      <title>sketchPath(), dataPath() not defined</title>
      <link>https://forum.processing.org/two/discussion/13222/sketchpath-datapath-not-defined</link>
      <pubDate>Sat, 24 Oct 2015 09:47:55 +0000</pubDate>
      <dc:creator>kimaldis</dc:creator>
      <guid isPermaLink="false">13222@/two/discussions</guid>
      <description><![CDATA[<p>Processing 2, python &amp; java, I'm getting undefined errors with these two functions. Are these Processing 3 only, if so, are there alternatives for Processing 2?</p>

<p>thanks.</p>
]]></description>
   </item>
   <item>
      <title>use launch() for applications kept in data folder</title>
      <link>https://forum.processing.org/two/discussion/13053/use-launch-for-applications-kept-in-data-folder</link>
      <pubDate>Fri, 16 Oct 2015 17:48:59 +0000</pubDate>
      <dc:creator>dangus_taargus</dc:creator>
      <guid isPermaLink="false">13053@/two/discussions</guid>
      <description><![CDATA[<p>How can I, or is there a way to do this?</p>

<p>I can get launch to work fine if I point the string at a data path specific to that windows user. However, as this sketch is intended to be a menu to launch a bunch of games(not made in processing) that will be deployed to several different computers, I wanted all the application data to be self contained, so that I simply compile it, and not concern myself with where the .exe's are located.</p>

<p>this isn't working:</p>

<p>launch("data/games/game.exe");</p>

<p>Am I barking up the wrong tree here? thanks!</p>
]]></description>
   </item>
   <item>
      <title>Save individual image files scraped from API</title>
      <link>https://forum.processing.org/two/discussion/12863/save-individual-image-files-scraped-from-api</link>
      <pubDate>Wed, 07 Oct 2015 01:36:47 +0000</pubDate>
      <dc:creator>N4yana</dc:creator>
      <guid isPermaLink="false">12863@/two/discussions</guid>
      <description><![CDATA[<p>My processing sketch currently grabs 16 images from the New York Times API and output them as a grid. 
I also want to save the individual images (not the canvas as a whole) as .jpgs within the folder but have been unsuccessful so far</p>

<p>Any help is much appreciated!</p>

<p>Thanks</p>

<pre><code>String baseURL = "http://" + "api.nytimes.com/svc/topstories/v1/";
String baseURLend= ".json?api-key=d4503d73029e6b27fdf3615c1490c4d4:12:62206830";
String homeURL;
PImage home;

void setup(){
  size(840, 560);
  background(0);
  noStroke();
  fill(102);
getHome();
home = loadImage(homeURL, "jpg");
noLoop();
}

void draw(){

  image(home, 0, 0);
}

void getHome() {

String request = baseURL + "home" + baseURLend;
String result = join( loadStrings( request ), "");
//println( result );

JSONObject nytData = JSONObject.parse(result);
//println(nytData.getString("section"));

JSONArray docArray = nytData.getJSONArray("results");
JSONObject levelOne = docArray.getJSONObject(1);
//println (levelOne);
JSONArray multiMedia = levelOne.getJSONArray("multimedia");
//println (multiMedia);
JSONObject thumbLarge = multiMedia.getJSONObject(3);
//println (thumbLarge);
homeURL = thumbLarge.getString("url");
println(homeURL);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Include the files from the data directory in Eclipse, and have it working in Exports</title>
      <link>https://forum.processing.org/two/discussion/12673/include-the-files-from-the-data-directory-in-eclipse-and-have-it-working-in-exports</link>
      <pubDate>Thu, 24 Sep 2015 14:02:53 +0000</pubDate>
      <dc:creator>phoebus</dc:creator>
      <guid isPermaLink="false">12673@/two/discussions</guid>
      <description><![CDATA[<p>Hello</p>

<p>My processing project in Eclipse is using a txt file to store stuff.
it all works ok until I try to Export the application.
The process creates the "application.linux/", "application.macosx/" and "application.windows/" folders with the application things in it but my txt file is not there.</p>

<p>I did try what was propose here*, didn't work any better.
I did with my txt file in a data/ folder in src/, with the txt file in a data/ folder at root level
and with the txt file simply dropped at root level.
No better luck</p>

<p>any idea ?</p>

<p>cheers</p>

<p>*<a href="https://processing.org/discourse/beta/num_1209991253.html" target="_blank" rel="nofollow">https://processing.org/discourse/beta/num_1209991253.html</a>
"Here's how I got it Eclipse to include the files from the data directory at runtime :</p>

<ul>
<li>if it isn't there already, copy/create the data directory into your Eclipse project (on the same level as the src dir)</li>
</ul>

<p>so</p>

<p>myProject
|<strong>src
|__data
|____file1.ext
|____file1.ext
|____...
|</strong>...</p>

<ul>
<li><p>refresh your project in Eclipse (RMB -&gt; Refresh, or F5). You should now see the data dir and its contents reflected in Eclipse.</p></li>
<li><p>make Eclipse aware that it has to include the files at runtime:  Eclipse -&gt; Run menu -&gt; Run Configurations -&gt; Classpath -&gt; User Entries -&gt; Advanced -&gt; Add Folders -&gt; select the data dir"</p></li>
</ul>
]]></description>
   </item>
   <item>
      <title>Choice where to display the fullscreen from external file</title>
      <link>https://forum.processing.org/two/discussion/12568/choice-where-to-display-the-fullscreen-from-external-file</link>
      <pubDate>Fri, 18 Sep 2015 11:43:35 +0000</pubDate>
      <dc:creator>Stanlepunk</dc:creator>
      <guid isPermaLink="false">12568@/two/discussions</guid>
      <description><![CDATA[<p>I need to choice on which screen to display my fullscreen but unfortunatly with the new method apparently is not possible because fullscreen() method must be the first line to be read...</p>

<pre><code>void setup() {
  fullScreen(info_from_external_file()) ;
}

int info_from_external_file() {
  return 2 ;
}
</code></pre>

<p><img src="" alt="" /><img src="http://forum.processing.org/two/uploads/imageupload/518/P1BG8UE4056C.png" alt="Capture d’écran 2015-09-18 à 13.38.32" title="Capture d’écran 2015-09-18 à 13.38.32" /></p>
]]></description>
   </item>
   </channel>
</rss>