# Canvas being redrawn at 200x200 px

**URL:** <https://discourse.processing.org/t/canvas-being-redrawn-at-200x200-px/43177>\
**Category:** Beginners\
**Tags:** homework\
**Created:** [November 9, 2023, 12:43pm UTC](https://discourse.processing.org/t/canvas-being-redrawn-at-200x200-px/43177 "2023-11-09T12:43:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavevaD](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/davevad/32/18975_2.png) [@DavevaD](https://discourse.processing.org/u/DavevaD)\
**Post date:** [November 9, 2023, 12:43pm UTC](https://discourse.processing.org/t/canvas-being-redrawn-at-200x200-px/43177/1 "2023-11-09T12:43:54Z")

</div>

Hi All,

For some reason this sketch keeps displaying a canvas at 200x200px when I want it to be 500x500. The image is not scaled down, it just shows the top, left corner. When first building this sketch with just one image it worked and I was able to see the entire image. This behavior started when I added the preload function. In vscode the word setup in the setup function is darker now too. Something is going on that I don’t understand. The same behavior occurs in the online p5js editor.

Thank you!

```auto
let img = [];

function preload() {
  for (let i = 0; i < 10; i++) {
    img[i] = loadImage("assets/images/" + "meme" + i + ".jpg");
  }

  function setup() {
    createCanvas(500, 500);
  }
}

function draw() {
  noLoop();
  let randImg = random(img);
  image(randImg, 0, 0, 500, 500);
}

```

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [November 9, 2023, 3:00pm UTC](https://discourse.processing.org/t/canvas-being-redrawn-at-200x200-px/43177/2 "2023-11-09T15:00:21Z")

</div>

Do you really want function setup() inside of function preload()? Usually they are separate.

---

<div class="post-metadata">

**Author:** ![DavevaD](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/davevad/32/18975_2.png) [@DavevaD](https://discourse.processing.org/u/DavevaD)\
**Post date:** [November 9, 2023, 7:30pm UTC](https://discourse.processing.org/t/canvas-being-redrawn-at-200x200-px/43177/3 "2023-11-09T19:30:05Z")

</div>

No! I can’t believe I didn’t see that. It works now, thank you!!! 😂
