# Exporting still images from animations

**URL:** https://discourse.processing.org/t/exporting-still-images-from-animations/31666
**Category:** Coding Questions
**Created:** [August 10, 2021, 5:34pm UTC](https://discourse.processing.org/t/exporting-still-images-from-animations/31666 "2021-08-10T17:34:42Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)
#### Post date: [August 11, 2021, 8:46pm UTC](https://discourse.processing.org/t/exporting-still-images-from-animations/31666/14 "2021-08-11T20:46:30Z")

</div>

I have tried with this, but does not do anything

```auto
float blueX;
float blueY;

float redX;
float redY;

import processing.pdf.*;

void setup() {
  size(500, 500, PDF, "filename.pdf");
  
  blueX = width*.25;
  blueY = height/2;

  redX = width*.75;
  redY = height/2;

  background(255);
  
  frameRate(1000);
}

void draw() {

  stroke(0,0,255);
  strokeWeight(2);
  
  blueX += random(-2, 2);
  blueY += random(-2, 2);
    
  if(blueX < 0){
    blueX = width;
  }
  if(blueX > width){
    blueX = 0;
  }

  if(blueY < 0){
    blueY = height;
  }
  if(blueY > height){
    blueY = 0;
  }
  
  point(blueX, blueY);
  
  stroke(255,0,0);
  strokeWeight(2);
  
  redX += random(-2, 2);
  redY += random(-2, 2);
  
  if(redX < 0){
    redX = width;
  }
  if(redX > width){
    redX = 0;
  }
  
  if(redY < 0){
    redY = height;
  }
  if(redY > height){
    redY = 0;
  }  
  
  point(redX, redY);
  
 if (mousePressed == true) {
saveFrame();
} 

println("Finished."); 
exit();

  
}
  
  

```

---

_[View the full topic](https://discourse.processing.org/t/exporting-still-images-from-animations/31666)._
