# Help building a distributed canvas

**URL:** <https://discourse.processing.org/t/help-building-a-distributed-canvas/3605>\
**Category:** Processing for Pi\
**Created:** [September 17, 2018, 3:53pm UTC](https://discourse.processing.org/t/help-building-a-distributed-canvas/3605 "2018-09-17T15:53:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjs](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@cjs](https://discourse.processing.org/u/cjs)\
**Post date:** [September 17, 2018, 3:53pm UTC](https://discourse.processing.org/t/help-building-a-distributed-canvas/3605/1 "2018-09-17T15:53:55Z")

</div>

Hello processing forum. I have questions to ask because i’m new to processing and i’m still confused.  
I will write my questions below.

I want to make a distributed scetch which is shown on one machine while other machine(s) send the desired scetch back to the first machine.  
I guess i’m using the net library and i create a server and a client.

1)Which method am i supposed to use to send back to the server the whole scetch i have created on the client ?

1. Is it possible to assign a client to send a portion on the created scetch back to the server ? How can i accomplish that ?

Thanks for reading and im waiting for a response from more experienced Processing users than me.

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [September 17, 2018, 6:22pm UTC](https://discourse.processing.org/t/help-building-a-distributed-canvas/3605/2 "2018-09-17T18:22:17Z")

</div>

This is a pretty big question, and it’s going to be hard to give you one specific answer.

Like many things in programming, there isn’t just one way to do this. How you approach it really depends on you and your context more than anything.

But speaking generally, I would try to [break your problem down into smaller steps](https://happycoding.io/tutorials/how-to/program) and take those steps on one at a time. can you get a simple client-server working where you send a hard-coded message between them? The [Network library](https://processing.org/reference/libraries/net/index.html) might be helpful.

After you have that working, then you can think about how you’d send more complicated data. Good luck!

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [September 18, 2018, 2:25pm UTC](https://discourse.processing.org/t/help-building-a-distributed-canvas/3605/3 "2018-09-18T14:25:35Z")

</div>

> [@cjs](#):
>
> I want to make a distributed scetch which is shown on one machine

So to understand your question, do you want to share what one person sees in the screen, or a portion of it, in another machine through a network? Or are you looking for an interactive experience between the machines?

Kf

---

<div class="post-metadata">

**Author:** ![cjs](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@cjs](https://discourse.processing.org/u/cjs)\
**Post date:** [September 18, 2018, 4:51pm UTC](https://discourse.processing.org/t/help-building-a-distributed-canvas/3605/4 "2018-09-18T16:51:30Z")

</div>

I will discribe it as silmple as i can.

Im using multiple raspberry pis which are plugged in to the network.

First step: I want my entire canvas created on one raspberry to show up on another raspberry.

Second step: I want each raspberry to send a portion of the canvas, to the “master” raspberry (aka server) , so the whole canvas is depicted there.

Thanks for your interest and i hope i did not confuse you more.

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [September 18, 2018, 5:43pm UTC](https://discourse.processing.org/t/help-building-a-distributed-canvas/3605/5 "2018-09-18T17:43:38Z")

</div>

For transfering images between your Pi units, use the following reference: [https://shiffman.net/processing.org/udp/2010/11/13/streaming-video-with-udp-in-processing/](https://shiffman.net/processing.org/udp/2010/11/13/streaming-video-with-udp-in-processing/) This reference is good for transferring a whole image or portions of images.

For the second part, getting the image from your sketch: Use `PImage.get()` to get the current image in your sketch. Then you can use the above to send it to other(s) R-pi’s. To get a portion of the image, you can use the same `get()` image but using the 4 parameter function.You can find about the full functionality of `get()` in the reference in the Processing Foundation’s website.

I will also suggest to explore previous posts related to transferring data between devices in a client-server configuration. Transferring images is not as common in this forum, but you should be able to get some code to get you started. One last thing: The UDP library works for the java version of Processing on Desktop. It should work for R-pi’s as well. However, take this with a grain of salt as I do not work with those units.

Kf

---

<div class="post-metadata">

**Author:** ![cjs](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@cjs](https://discourse.processing.org/u/cjs)\
**Post date:** [September 18, 2018, 6:31pm UTC](https://discourse.processing.org/t/help-building-a-distributed-canvas/3605/6 "2018-09-18T18:31:46Z")

</div>

Much appreciated for explaining and sending the link.  
To be 100% precise, i don’t want to transfer an image itself, but something more complex like [this](https://processing.org/examples/wolfram.html)

In this case, am i still going the way you suggested ? Thanks and sorry for the mess.

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [September 19, 2018, 6:45am UTC](https://discourse.processing.org/t/help-building-a-distributed-canvas/3605/7 "2018-09-19T06:45:41Z")

</div>

You should be able to transfer an actual image generated in the server Raspberry Pi. Exchanging iamges just required an extra amount of work. Now, if all images are reproduced by some algorithm engine of yours, and if this algorithm engine is embedded in each Pi unit, then I could foresee sending _only_ the parameters to drive the algorithm to generate the image instead of sending it. You could use for this the **oscP5** library. You can check the [examples](http://www.sojamo.de/libraries/oscP5/#examples) and [documentation](http://www.sojamo.de/libraries/oscP5/reference/index.html)

Kf
