# Surface Resize issues

**URL:** https://discourse.processing.org/t/surface-resize-issues/32237
**Category:** Coding Questions
**Created:** [September 13, 2021, 6:44pm UTC](https://discourse.processing.org/t/surface-resize-issues/32237 "2021-09-13T18:44:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![philspitler](https://avatars.discourse-cdn.com/v4/letter/p/f1d935/32.png) [@philspitler](https://discourse.processing.org/u/philspitler)
#### Post date: [September 13, 2021, 6:44pm UTC](https://discourse.processing.org/t/surface-resize-issues/32237/1 "2021-09-13T18:44:00Z")

</div>

Hi, I am having trouble changing the size of my surface in a sketch.

Basically I load an image, set the surface size to the size of the image then draw circles on the surface.

The issue is that Processing is actually scaling the surface after I draw the circles instead of before so if my image is 1000x1000 pixels and I start with a size of 100,100, everything gets scales 10x.

I would like to resize the surface prior to drawing the circles.

It seems like the resize doesn’t happen until the end of draw().

Is there any way round this?

Thanks

Phil

```auto
size(100,100);
img = loadImage(path);   
      int sx = img.width;
      int sy = img.height;
      surface.setResizable(true);
      surface.setSize(sx, sy);

      // now I add all my circles

```

---

<div class="post-metadata">

### Author: ![Flolo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/flolo/32/13874_2.png) [@Flolo](https://discourse.processing.org/u/Flolo)
#### Post date: [September 13, 2021, 9:47pm UTC](https://discourse.processing.org/t/surface-resize-issues/32237/2 "2021-09-13T21:47:02Z")

</div>

maybe this helps?

```auto
scale(0.1);

```

---

<div class="post-metadata">

### Author: ![Flolo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/flolo/32/13874_2.png) [@Flolo](https://discourse.processing.org/u/Flolo)
#### Post date: [September 13, 2021, 10:04pm UTC](https://discourse.processing.org/t/surface-resize-issues/32237/3 "2021-09-13T22:04:53Z")

</div>

Hey I think you just have to re draw you circles 🙂

Here is the code I wrote:

```auto
PImage img;

boolean keyWasPressed = false;

void setup() {
  size(600, 600);
  frameRate(1);
  //load the image on start so the programm dont have to load it while running.. 
  img = loadImage("https://pixy.org/src/480/4800346.jpg");
}
void draw() {
  background(0);
  fill(255);
  textAlign(CENTER, CENTER);
  textSize(60);
  text("PRESS A KEY", 0, 0, width, height);

  fill(255);
  ellipse(200, 200, 30, 30);

  if (keyWasPressed) {
    //if key was pressed draw the image with alpha = 120
    tint(255, 120);
    image(img, 0, 0);
  }
}
void keyPressed() {
  keyWasPressed = true;
  surface.setSize(img.width, img.height);
}

```
