# Taking Screenshot with OpenGL sketch

**URL:** <https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064>\
**Category:** Processing for Pi\
**Created:** [July 25, 2018, 10:11am UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064 "2018-07-25T10:11:08Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [July 25, 2018, 10:11am UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/1 "2018-07-25T10:11:08Z")

</div>

Previously I tried to take screenshots of opengl sketches with scrot, but that doesn’t work see [Processing window not showing in screenshot](https://discourse.processing.org/t/processing-window-not-showing-in-screenshot/2009/4), however the [raspi2png](https://github.com/AndrewFromMelbourne/raspi2png) app which is easy to install does work.  
Scrot

 ![scrot](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/1X/60fe037035c1027988cd75455bc71c2698ae36a6.jpg)  
raspi2png  
 ![snapshot](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/1X/4076a552a324b9a072b1a7ac5182fe8f22fe230f.jpg)

---

<div class="post-metadata">

**Author:** ![lqdev](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lqdev/32/29_2.png) [@lqdev](https://discourse.processing.org/u/lqdev)\
**Post date:** [July 25, 2018, 2:01pm UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/2 "2018-07-25T14:01:57Z")

</div>

Try the `save()` function.

```auto
size(200, 200, P2D);
rect(50, 50, 50, 50);
save("screenshot.png");

```

Works perfectly on Windows 10 Spring Creators and Raspbian Stretch.

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [July 25, 2018, 6:32pm UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/3 "2018-07-25T18:32:05Z")

</div>

**Ahem** here is the Processing PI section, and therefore of interest to users of processing on the RaspberryPi operating system. Furthermore its in the title “Screenshot”, any fool can save a sketch.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [July 25, 2018, 6:39pm UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/4 "2018-07-25T18:39:03Z")

</div>

Maybe you should re-read his answer! 😉

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [July 26, 2018, 7:42am UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/5 "2018-07-26T07:42:25Z")

</div>

That still is not the point, if what you want is a screenshot (ie whole screen including the sketch) what he suggests simply does not do it!!! This is of interest to those people that have tried scrot to do the same thing, which works OK with non-opengl sketches, but fails to display opengl sketches.😠

---

<div class="post-metadata">

**Author:** ![lqdev](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lqdev/32/29_2.png) [@lqdev](https://discourse.processing.org/u/lqdev)\
**Post date:** [July 26, 2018, 9:42am UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/6 "2018-07-26T09:42:47Z")

</div>

Well you can try scrot with the `save()` function and combining them in an image editor. I know it is not as easy, however, it works. Pinta could be a sufficient image editor.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [July 26, 2018, 1:18pm UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/7 "2018-07-26T13:18:25Z")

</div>

> [@monkstone](#):
>
> That still is not the point

I quite understood your point - just found your response overly aggressive. And the reply is relevant to the Pi.

Incidentally, I noticed that raspi2png has an open bug related to the OpenGL driver. Although does scrot work in that case?

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [July 26, 2018, 1:33pm UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/8 "2018-07-26T13:33:25Z")

</div>

Yes but see it from my point of view, I post something that might be interesting to RaspberryPi users, it was not a request for help, and look what mess this has become, compounded by your unwelcome intervention!!!

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [July 26, 2018, 5:57pm UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/9 "2018-07-26T17:57:40Z")

</div>

> [@monkstone](#):
>
> look what mess this has become, compounded by your unwelcome intervention!!!

You’re the one who responded uncivilly rather than simply explaining the difference in what you were trying to accomplish and what had been posted. It’s a public forum - it’s all about friendly dialogue! 😄

There was incidentally a technical query in my post too - does either work with the OpenGL driver? (I’m not in a position to test at the moment).

---

<div class="post-metadata">

**Author:** ![dan850](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dan850](https://discourse.processing.org/u/dan850)\
**Post date:** [July 26, 2018, 11:40pm UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/10 "2018-07-26T23:40:24Z")

</div>

i’m sure everyone on this forum that has interest or will have interest in this topic can appreciate multiple solutions. No need for the aggressive comments please:-)

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [July 27, 2018, 5:21am UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/11 "2018-07-27T05:21:32Z")

</div>

OK lets be clear about this, did you follow the links in my posting? Because if you had it should be perfectly clear that raspi2png works see screenshot of processing sketch [Processing window not showing in screenshot](https://discourse.processing.org/t/processing-window-not-showing-in-screenshot/2009/4). Further see TfGuy44 response to ben\_suddenly. Now can you see my point. Both saveFrame and save work as expected, but that is not a screenshot, that ben\_suddenly requested…  
It is interesting to be able create screenshots to demonstrate that sketches run on raspberryPI, I was particularly pleased to find that raspi2png works as I had previously tried scrot got the same results as ben\_suddenly, and therefore resorted to using saveFrame, but it doesn’t tell the story that the screenshot does.

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [July 27, 2018, 5:38pm UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/12 "2018-07-27T17:38:27Z")

</div>

You’ve got it wrong there, no solutions were required, my post was designed to pass on some useful information and I get this unwelcome response from a windows user (on a section for processingPI users) who does not appear to have read either the title or content of my post. If either he or Neil C Smith had followed the link it should have been clear to them no solution was required.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [July 27, 2018, 5:53pm UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/13 "2018-07-27T17:53:37Z")

</div>

> [@monkstone](#):
>
> unwelcome response from a windows user (on a section for processingPI users) who does not appear to have read either the title or content of my post

And if you’d read all of _his_ post you’d have seen “Raspbian Stretch”! And yes, I had already read your links and knew why it was different - it was a tongue in cheek reply to get you to re-read and explain the difference rather than go all out attack.

---

<div class="post-metadata">

**Author:** ![dan850](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dan850](https://discourse.processing.org/u/dan850)\
**Post date:** [July 27, 2018, 8:44pm UTC](https://discourse.processing.org/t/taking-screenshot-with-opengl-sketch/2064/14 "2018-07-27T20:44:05Z")

</div>


