# Displaying image slows down program

**URL:** <https://discourse.processing.org/t/displaying-image-slows-down-program/8001>\
**Category:** Coding Questions\
**Created:** [January 31, 2019, 7:45pm UTC](https://discourse.processing.org/t/displaying-image-slows-down-program/8001 "2019-01-31T19:45:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![8BitRift](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/8bitrift/32/3495_2.png) [@8BitRift](https://discourse.processing.org/u/8BitRift)\
**Post date:** [January 31, 2019, 7:45pm UTC](https://discourse.processing.org/t/displaying-image-slows-down-program/8001/1 "2019-01-31T19:45:47Z")

</div>

EDIT I figured out why the the program was slowing down but this has spawned a new question I have with the same title so ill just reword it.

Why does rendering a copied image cripple framerate, for example:

```auto
PImage imagez;

void setup() {
  size(1600,800, P3D);
  imagez = loadImage("ShipBattle.jpg");
  imagez.resize(800,800);
  background(155);
}

void draw() {
  background(155);
  PImage copies = imagez.copy();
  println(frameRate);
  image(copies,0,0);
  image(imagez,800,0);
}

```

This program runs at about 20fps when it should be doing 60, although if I comment out the line:

```auto
image(copies,0,0);

```

The program runs at the full 60fps. So why does rendering a copied image destroy the framerate with seemingly no reason?

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [February 1, 2019, 1:28am UTC](https://discourse.processing.org/t/displaying-image-slows-down-program/8001/2 "2019-02-01T01:28:38Z")

</div>

because you not render only a copied image,  
you do the copy also at every draw loop.  
so you can live live with that speed if you need to copy different images or different parts of the image in every loop ( lots of flickering anyway )

or you move the copy line up into the setup.  
so you get 2 “fix” images to show ( with the possibly 60 FPS ).
