# Beginners

**URL:** https://discourse.processing.org/c/processing/processing-beginners/14.md?page=15

[Latest](https://discourse.processing.org/latest.md) · [Categories](https://discourse.processing.org/categories.md) · [Tags](https://discourse.processing.org/tags.md)

**Page:** 16

---

## [loadImage only if file exist](https://discourse.processing.org/t/loadimage-only-if-file-exist/33929)

<div class="topic-metadata">

**Author:** [@rizn](https://discourse.processing.org/u/rizn)\
**Replies:** 5\
**Last updated:** [December 5, 2021, 7:34pm UTC](https://discourse.processing.org/t/loadimage-only-if-file-exist/33929 "2021-12-05T19:34:57Z")

</div>

hi. i use loadImage() for a sketch, to read a lot of images from web and export it to pdf. its working fine. Is there a way to ask, if the image-file exist before using loadImage()? In my case, if some files dont exi…

---

## [Memory optimization and resizing](https://discourse.processing.org/t/memory-optimization-and-resizing/33878)

<div class="topic-metadata">

**Author:** [@F1yin](https://discourse.processing.org/u/F1yin)\
**Replies:** 3\
**Last updated:** [December 5, 2021, 2:06pm UTC](https://discourse.processing.org/t/memory-optimization-and-resizing/33878 "2021-12-05T14:06:08Z")

</div>

Hi everyone! I’m extremely new to processing and coding as a whole, and so I have many questions. But one, in particular, I haven’t been able to find on google. I am creating a GUI dashboard that will eventually interfa…

---

## [Find space in string](https://discourse.processing.org/t/find-space-in-string/33760)

<div class="topic-metadata">

**Author:** [@yalaniv](https://discourse.processing.org/u/yalaniv)\
**Replies:** 5\
**Last updated:** [December 4, 2021, 10:57pm UTC](https://discourse.processing.org/t/find-space-in-string/33760 "2021-12-04T22:57:08Z")

</div>

I have a sentece as a string, and I want to print in on the screen, each word in different line, but when I try to comapre if the current char is space, I get this error: cannot convert from char to String, regarding …

---

## [Is possible use Processing library (ex. Network Library) on p5.js?](https://discourse.processing.org/t/is-possible-use-processing-library-ex-network-library-on-p5-js/33919)

<div class="topic-metadata">

**Author:** [@Stefano](https://discourse.processing.org/u/Stefano)\
**Replies:** 1\
**Last updated:** [December 4, 2021, 1:36pm UTC](https://discourse.processing.org/t/is-possible-use-processing-library-ex-network-library-on-p5-js/33919 "2021-12-04T13:36:50Z")

</div>

Hello everybody, I want do the example of the Network Library of Processing “Shared drawing canvas” using my MAC with the Processing code as a server and my IPad with Processing.app (p5.js) as a client, how can this be …

---

## [Is possible use Shared drawing canvas (example code) on P5.js (IPad)?](https://discourse.processing.org/t/is-possible-use-shared-drawing-canvas-example-code-on-p5-js-ipad/33917)

<div class="topic-metadata">

**Author:** [@Stefano](https://discourse.processing.org/u/Stefano)\
**Replies:** 0\
**Last updated:** [December 4, 2021, 12:34pm UTC](https://discourse.processing.org/t/is-possible-use-shared-drawing-canvas-example-code-on-p5-js-ipad/33917 "2021-12-04T12:34:51Z")

</div>

Hello everybody, I want do the example of the Network Library of Processing “Shared drawing canvas” using my MAC with the processing code as a server and my IPad with Processing.app (p5.js) as a client, how can this be …

---

## [X=y=z doesn't return error](https://discourse.processing.org/t/x-y-z-doesnt-return-error/33912)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 3\
**Last updated:** [December 4, 2021, 9:31am UTC](https://discourse.processing.org/t/x-y-z-doesnt-return-error/33912 "2021-12-04T09:31:05Z")

</div>

I was making a simple project, when I mistyped the code and ended with this. What does it do? Why doesn’t it return an error? Why is ON underlined in yellow? Doesn’t it change? Or is it because it is not used later in …

---

## [How to randomly change the background color between 'X' amount of static colors with each output](https://discourse.processing.org/t/how-to-randomly-change-the-background-color-between-x-amount-of-static-colors-with-each-output/33880)

<div class="topic-metadata">

**Author:** [@sloppy](https://discourse.processing.org/u/sloppy)\
**Replies:** 2\
**Last updated:** [December 2, 2021, 4:16pm UTC](https://discourse.processing.org/t/how-to-randomly-change-the-background-color-between-x-amount-of-static-colors-with-each-output/33880 "2021-12-02T16:16:21Z")

</div>

I’ve been trying this for a couple of days and can never seem to get it right with what I imagine would be a simple piece of syntax/code. Each generated image’s background I want to either be between -1 to 256, and also…

---

## [Daft question about variable using mouseX and mouseY](https://discourse.processing.org/t/daft-question-about-variable-using-mousex-and-mousey/33875)

<div class="topic-metadata">

**Author:** [@AudioBabble](https://discourse.processing.org/u/AudioBabble)\
**Replies:** 5\
**Last updated:** [December 2, 2021, 1:15pm UTC](https://discourse.processing.org/t/daft-question-about-variable-using-mousex-and-mousey/33875 "2021-12-02T13:15:32Z")

</div>

I have a daft question… why do get no output when I define a variable using mouseX & mouseY? int XY = mouseX+mouseY; void draw() { println(XY,mouseX+mouseY); } left-hand number stays at zero, right hand number cha…

---

## [How to know if certain pixel is red, or blue, or green](https://discourse.processing.org/t/how-to-know-if-certain-pixel-is-red-or-blue-or-green/33802)

<div class="topic-metadata">

**Author:** [@yalaniv](https://discourse.processing.org/u/yalaniv)\
**Replies:** 9\
**Last updated:** [November 30, 2021, 8:14pm UTC](https://discourse.processing.org/t/how-to-know-if-certain-pixel-is-red-or-blue-or-green/33802 "2021-11-30T20:14:30Z")

</div>

I want to change colors from of a certain image, so all the reds will be certain blue, and all the blues will be certain blue. in order to do that, I am looking for some logic in the colors numbers, so I can use a simp…

---

## [Mouse frustration!](https://discourse.processing.org/t/mouse-frustration/33789)

<div class="topic-metadata">

**Author:** [@AudioBabble](https://discourse.processing.org/u/AudioBabble)\
**Replies:** 12\
**Last updated:** [November 28, 2021, 1:52pm UTC](https://discourse.processing.org/t/mouse-frustration/33789 "2021-11-28T13:52:03Z")

</div>

I’m sure this has been asked a million times, so sorry for the repetition. I’m having a hell of a time with mousePressed, mouseClicked, etc To confuse me further I’ve just seen an example in the guidance for beginners …

---

## [Export console println as text](https://discourse.processing.org/t/export-console-println-as-text/33810)

<div class="topic-metadata">

**Author:** [@yalaniv](https://discourse.processing.org/u/yalaniv)\
**Replies:** 1\
**Last updated:** [November 29, 2021, 1:30am UTC](https://discourse.processing.org/t/export-console-println-as-text/33810 "2021-11-29T01:30:41Z")

</div>

Is there an option to export the console output as a txt or something? I need to println more than 10k lines, but it only shows the last few dozens

---

## [Connect only every third circle](https://discourse.processing.org/t/connect-only-every-third-circle/33798)

<div class="topic-metadata">

**Author:** [@Kristina](https://discourse.processing.org/u/Kristina)\
**Replies:** 3\
**Last updated:** [November 28, 2021, 7:12pm UTC](https://discourse.processing.org/t/connect-only-every-third-circle/33798 "2021-11-28T19:12:55Z")

</div>

Hey, i would really appreciate some help with an assignement i have to do. I had to create this picture of a row of circles at the top and bottom. Each circle is connected with the others at the Bottom or Top. This is th…

---

## [Empty folders upon macOS install](https://discourse.processing.org/t/empty-folders-upon-macos-install/33690)

<div class="topic-metadata">

**Author:** [@daFrenchFrog](https://discourse.processing.org/u/daFrenchFrog)\
**Replies:** 1\
**Last updated:** [November 27, 2021, 8:48am UTC](https://discourse.processing.org/t/empty-folders-upon-macos-install/33690 "2021-11-27T08:48:44Z")

</div>

Hello, This feels like a silly question but I looked for a solution and found nothing. I download the processing zip file Uncompress it Move the processing.app file (the only file in the zip file) to the application f…

---

## [Problem in code 2](https://discourse.processing.org/t/problem-in-code-2/33755)

<div class="topic-metadata">

**Author:** [@dohvk](https://discourse.processing.org/u/dohvk)\
**Replies:** 3\
**Last updated:** [November 25, 2021, 3:22pm UTC](https://discourse.processing.org/t/problem-in-code-2/33755 "2021-11-25T15:22:36Z")

</div>

Hello everyone, I have a problem with my code. I would want to click on one single rectangle to change the color of it but every rectangle change color at the same time. Can someone help? And is there a function to give …

---

## [Turning a set of string to constant case](https://discourse.processing.org/t/turning-a-set-of-string-to-constant-case/33745)

<div class="topic-metadata">

**Author:** [@it\_begins](https://discourse.processing.org/u/it_begins)\
**Replies:** 1\
**Last updated:** [November 25, 2021, 12:18pm UTC](https://discourse.processing.org/t/turning-a-set-of-string-to-constant-case/33745 "2021-11-25T12:18:56Z")

</div>

Help needed urgently. I have a question that needs to change a set of strings to constant case. That is replacing spaces with underscores, removing punctuations, and capitalizing all letters. using only these string fun…

---

## [Problem in code](https://discourse.processing.org/t/problem-in-code/33700)

<div class="topic-metadata">

**Author:** [@dohvk](https://discourse.processing.org/u/dohvk)\
**Replies:** 1\
**Last updated:** [November 23, 2021, 8:05pm UTC](https://discourse.processing.org/t/problem-in-code/33700 "2021-11-23T20:05:40Z")

</div>

Hello everyone! I am a beginner in Processing and I have a problem with my code. I have random rectangles but now i want them to be aligned: 4 rows in each 4 rectangles (16 in total). Can someone help? This is my code f…

---

## [How can I save lines?](https://discourse.processing.org/t/how-can-i-save-lines/33634)

<div class="topic-metadata">

**Author:** [@Blah](https://discourse.processing.org/u/Blah)\
**Replies:** 6\
**Last updated:** [November 20, 2021, 6:14pm UTC](https://discourse.processing.org/t/how-can-i-save-lines/33634 "2021-11-20T18:14:16Z")

</div>

I need the lines drawn to be saved and match up to form an overall route. Really confused as to what’s missing. float cx; // x coordinate of point 1 float cy; // x coordinate of point 1 int lastClickX = -1; int lastC…

---

## [How to make a simple animation of a heartbeat monitor](https://discourse.processing.org/t/how-to-make-a-simple-animation-of-a-heartbeat-monitor/33614)

<div class="topic-metadata">

**Author:** [@N00b](https://discourse.processing.org/u/N00b)\
**Replies:** 1\
**Last updated:** [November 19, 2021, 1:35pm UTC](https://discourse.processing.org/t/how-to-make-a-simple-animation-of-a-heartbeat-monitor/33614 "2021-11-19T13:35:54Z")

</div>

Hello everyone, I’m very lost! I need to make a simple animation of a heartbeat monitor. The default setting should just be a simple horizontal line in the middle of the screen and when key pressed the line should take …

---

## [Any way to export 3D interactive to .obj or other 3d format?](https://discourse.processing.org/t/any-way-to-export-3d-interactive-to-obj-or-other-3d-format/33555)

<div class="topic-metadata">

**Author:** [@Guy\_Sky](https://discourse.processing.org/u/Guy_Sky)\
**Replies:** 0\
**Last updated:** [November 16, 2021, 1:12pm UTC](https://discourse.processing.org/t/any-way-to-export-3d-interactive-to-obj-or-other-3d-format/33555 "2021-11-16T13:12:36Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hi There Project :slight\_smile: I want to scan old family photographs, front and back, make them an interactive “3D” (you can look at back or fr…

---

## [Setting a value once by turning off a boolean doesn't work](https://discourse.processing.org/t/setting-a-value-once-by-turning-off-a-boolean-doesnt-work/33467)

<div class="topic-metadata">

**Author:** [@Kenga123456](https://discourse.processing.org/u/Kenga123456)\
**Replies:** 6\
**Last updated:** [November 15, 2021, 1:28am UTC](https://discourse.processing.org/t/setting-a-value-once-by-turning-off-a-boolean-doesnt-work/33467 "2021-11-15T01:28:01Z")

</div>

float x1 = random(50, 450); float y1 = random(50, 450); int size1 = 100; float inc1X = 3; float inc1Y = 3; float x2 =x1; float y2 = x1; int size2 = 50; float inc2X = 3; float inc2Y = 3; boolean place1 = true; …

---

## [Using substring. What am I doing wrong?](https://discourse.processing.org/t/using-substring-what-am-i-doing-wrong/33503)

<div class="topic-metadata">

**Author:** [@FlyingApple](https://discourse.processing.org/u/FlyingApple)\
**Replies:** 2\
**Last updated:** [November 14, 2021, 3:02pm UTC](https://discourse.processing.org/t/using-substring-what-am-i-doing-wrong/33503 "2021-11-14T15:02:55Z")

</div>

println(p.state.substring(0,1), p.state); if (p.state.substring(0,1) == "W") { println("this is a test"); } p.state is “WPawn” p.state.substring(0, 1) is “W” However, “this is a test” is not being printed and I have…

---

## [Adapt display window size to image](https://discourse.processing.org/t/adapt-display-window-size-to-image/33472)

<div class="topic-metadata">

**Author:** [@elemau](https://discourse.processing.org/u/elemau)\
**Replies:** 2\
**Last updated:** [November 12, 2021, 4:48pm UTC](https://discourse.processing.org/t/adapt-display-window-size-to-image/33472 "2021-11-12T16:48:31Z")

</div>

I want to simply adapt the display window size to the image I load. I read that with processing3 it is not possible anymore to use variables for defining size and that it is necessary to use settings. I tried but it doe…

---

## [Getting a gradient RGB line using lerp](https://discourse.processing.org/t/getting-a-gradient-rgb-line-using-lerp/33424)

<div class="topic-metadata">

**Author:** [@endymion](https://discourse.processing.org/u/endymion)\
**Replies:** 1\
**Last updated:** [November 9, 2021, 8:51pm UTC](https://discourse.processing.org/t/getting-a-gradient-rgb-line-using-lerp/33424 "2021-11-09T20:51:11Z")

</div>

So I found some code that used lerp to create a gradient between black and white and I modified it to create a gradient between red and blue, but I’d like it to span the whole RGB spectrum: void gradient\_line( color s, …

---

## [Size only accepts literals not expressions 4 beta](https://discourse.processing.org/t/size-only-accepts-literals-not-expressions-4-beta/33372)

<div class="topic-metadata">

**Author:** [@seanc4s](https://discourse.processing.org/u/seanc4s)\
**Replies:** 4\
**Last updated:** [November 9, 2021, 12:12am UTC](https://discourse.processing.org/t/size-only-accepts-literals-not-expressions-4-beta/33372 "2021-11-09T00:12:15Z")

</div>

float\[\] data=new float\[50000\]; void setup(){ size(300\*3,300); background(0); for(int i=0;i\<50000;i++){ data\[i\]=randomGaussian(); } for(int i=0;i\<50000;i+=2){ int x=150+int(50f\*data\[i\]); int y=150+in…

---

## [Math doesn't work?](https://discourse.processing.org/t/math-doesnt-work/33384)

<div class="topic-metadata">

**Author:** [@stefanmz7](https://discourse.processing.org/u/stefanmz7)\
**Replies:** 11\
**Last updated:** [November 8, 2021, 1:24am UTC](https://discourse.processing.org/t/math-doesnt-work/33384 "2021-11-08T01:24:48Z")

</div>

Hey so why when I do location.y-brick1.y ,location 1 is positive brick1 is -500 it gives out a negative number? Like location.y–500 is location.y +500 so that’s positive. Do math rules not apply in processing?

---

## [Text position on screen](https://discourse.processing.org/t/text-position-on-screen/33234)

<div class="topic-metadata">

**Author:** [@hacketet](https://discourse.processing.org/u/hacketet)\
**Replies:** 4\
**Last updated:** [November 2, 2021, 1:54am UTC](https://discourse.processing.org/t/text-position-on-screen/33234 "2021-11-02T01:54:54Z")

</div>

Here’s the code I had to use to get text placed in a 30 x 22 rectangle. From the documentation I expected th using the diagonal coordinates of the rectangle to properly place the text, but it was WAY off. I had to mult…

---

## [Nf() number format decimal places to array using for loop](https://discourse.processing.org/t/nf-number-format-decimal-places-to-array-using-for-loop/33182)

<div class="topic-metadata">

**Author:** [@louise00](https://discourse.processing.org/u/louise00)\
**Replies:** 4\
**Last updated:** [November 1, 2021, 6:36pm UTC](https://discourse.processing.org/t/nf-number-format-decimal-places-to-array-using-for-loop/33182 "2021-11-01T18:36:05Z")

</div>

I’m migrating from p5js to processing and something from p5js that works really well its just getting stuck in processing. I’m trying to: • Define a PImage array • Load a set of images that are named 0.jpg ~ 11.jpg • …

---

## [Can't find the missing curly bracket](https://discourse.processing.org/t/cant-find-the-missing-curly-bracket/33152)

<div class="topic-metadata">

**Author:** [@hacketet](https://discourse.processing.org/u/hacketet)\
**Replies:** 7\
**Last updated:** [October 30, 2021, 3:51pm UTC](https://discourse.processing.org/t/cant-find-the-missing-curly-bracket/33152 "2021-10-30T15:51:32Z")

</div>

I can’t find the error associated with \<Syntax Error - Missing right curly bracket “}”\> The problem is in the last few lines of code. Lines underscored by the debugger are indicated by //!! which I inserted after pasti…

---

## [How to wait until a callback function has completed](https://discourse.processing.org/t/how-to-wait-until-a-callback-function-has-completed/33173)

<div class="topic-metadata">

**Author:** [@Grumpy\_Mike](https://discourse.processing.org/u/Grumpy_Mike)\
**Replies:** 4\
**Last updated:** [October 30, 2021, 12:23pm UTC](https://discourse.processing.org/t/how-to-wait-until-a-callback-function-has-completed/33173 "2021-10-30T12:23:18Z")

</div>

In processing 3 I have two call back functions, one to select an input file and the other to select an output file. In the setup function I want to call the input file select and then the output file select. But being c…

---

## [How to use static variables in Processing?](https://discourse.processing.org/t/how-to-use-static-variables-in-processing/32774)

<div class="topic-metadata">

**Author:** [@R1S8K](https://discourse.processing.org/u/R1S8K)\
**Replies:** 12\
**Last updated:** [October 27, 2021, 12:42am UTC](https://discourse.processing.org/t/how-to-use-static-variables-in-processing/32774 "2021-10-27T00:42:47Z")

</div>

Hi, I’m working on a LCD128x64 C code for an Arduino platform and doing my quick snippets with processing. Now, I need to use static variables inside a function, but apparently there are no static keyword in processing…

[Previous page](https://discourse.processing.org/c/processing/processing-beginners/14.md?page=14)

[Next page](https://discourse.processing.org/c/processing/processing-beginners/14.md?page=16)
