# Save screen to large tif file (9000px x 9000px)

**URL:** <https://discourse.processing.org/t/save-screen-to-large-tif-file-9000px-x-9000px/43491>\
**Category:** Coding Questions\
**Created:** [December 17, 2023, 9:57pm UTC](https://discourse.processing.org/t/save-screen-to-large-tif-file-9000px-x-9000px/43491 "2023-12-17T21:57:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoha](https://avatars.discourse-cdn.com/v4/letter/y/a4c791/32.png) [@Yoha](https://discourse.processing.org/u/Yoha)\
**Post date:** [December 17, 2023, 9:57pm UTC](https://discourse.processing.org/t/save-screen-to-large-tif-file-9000px-x-9000px/43491/1 "2023-12-17T21:57:28Z")

</div>

I have 100 moving circles all over the screen leaving a trail by puting a rectangle every frame in draw:

" void draw(){  
fill(0, 10);  
rect(0,0,width,height);  
etc… "

I want to export the screen at a given moment to a large .tif file (9000px x 9000 px.)

Two issues here:  
1/ running the programe in size(9000,9000) freezes the screen from the start and so no save can be performed.  
2/ tried exporting with PGraphics, but no success…

Like to understand why certain approaches don’t work.  
+  
Any solutions ?

Thanks a lot !

---

<div class="post-metadata">

**Author:** ![scudly](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/scudly/32/5597_2.png) [@scudly](https://discourse.processing.org/u/scudly)\
**Post date:** [December 18, 2023, 1:04am UTC](https://discourse.processing.org/t/save-screen-to-large-tif-file-9000px-x-9000px/43491/2 "2023-12-18T01:04:57Z")

</div>

PGraphics is definitely the way to do it. If you had no success, then that’s what you need to figure out.

Working with a PGraphics can be frustrating because you have to make sure that **every single** graphics call you make is applied to your target PGraphics and not to the default. That means if you can, for instance, `PGraphics pg;`, then you have to use `pg.background()`, `pg.colorMode(...)`, `pg.stroke(...)`, `pg.width`, and so on. It only takes missing one or two of those `pg.` prefixes to screw up your image. And then check the PGraphics with `image( pg, 0, 0, width, height);` in `draw()` to see if before you try saving.

I have output large PGraphics up to 16x16 times a 1920x1080 image, so large sizes shouldn’t be a problem. You just have to scour your code looking for anywhere you might have made a graphics call to the default drawing surface rather than your PGraphics. The one place you MIGHT have a problem is if your particular computer doesn’t have enough video memory. I don’t know what the image size limits might be on a Raspberry Pi, for instance.

As an example, note that the `circle()` had to use `pg.width` instead of `width` to center correctly. Even though it was the whole point of my post, I still made that mistake when I first typed this in.

```auto
PGraphics pg;

void setup() {
  size( 900, 900 );
  pg = createGraphics( 9000, 9000 );
  
  pg.beginDraw();
  pg.background( 255, 0, 0 );
  pg.circle( pg.width/2, pg.height/2, pg.width/4 );
  pg.endDraw();
  
  image( pg, 0, 0, width, height );
}

```

Then you can add `pg.save( "myImage.png" );` to save it.
