# Clone canvas to p5 creategraphics()

**URL:** <https://discourse.processing.org/t/clone-canvas-to-p5-creategraphics/31142>\
**Category:** Libraries\
**Created:** [July 9, 2021, 7:32pm UTC](https://discourse.processing.org/t/clone-canvas-to-p5-creategraphics/31142 "2021-07-09T19:32:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![atagger](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@atagger](https://discourse.processing.org/u/atagger)\
**Post date:** [July 9, 2021, 7:32pm UTC](https://discourse.processing.org/t/clone-canvas-to-p5-creategraphics/31142/1 "2021-07-09T19:32:41Z")

</div>

Is there a way to clone the entire p5 canvas to creategraphics? I’m trying to render a SVG using the p5.js-svg library, but I don’t want to set the entire canvas renderer to “SVG”, because I only need the output to happen at set intervals, and it takes a lot of power to write objects to both a pgraphics object and the canvas concurrently. Is there a way of somehow copying the canvas and then sending this over to a creategraphics object? I stumbled upon this, but don’t quite understand how it is implemented, it looks like it is modifying the p5 source:

[https://discourse.processing.org/t/creategraphics-referencing-existing-canvas-context/21067/3](https://discourse.processing.org/t/creategraphics-referencing-existing-canvas-context/21067/3)

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 9, 2021, 7:58pm UTC](https://discourse.processing.org/t/clone-canvas-to-p5-creategraphics/31142/2 "2021-07-09T19:58:26Z")

</div>

[forum.Processing.org/two/discussion/22039/using-creategraphics-get-in-the-draw-loop-causing-memory-usage#Item\_4](http://forum.Processing.org/two/discussion/22039/using-creategraphics-get-in-the-draw-loop-causing-memory-usage#Item_4)

> **[Transfer Pixels - OpenProcessing](https://openprocessing.org/sketch/421073)**
>
> Workaround for continuous screenshots

---

<div class="post-metadata">

**Author:** ![atagger](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@atagger](https://discourse.processing.org/u/atagger)\
**Post date:** [July 9, 2021, 8:09pm UTC](https://discourse.processing.org/t/clone-canvas-to-p5-creategraphics/31142/3 "2021-07-09T20:09:14Z")

</div>

This is super cool. What I’m trying to do is save as a SVG though, not as an image.  
I will use this for some other project.
