# Scale video to fit canvas size

**URL:** https://discourse.processing.org/t/scale-video-to-fit-canvas-size/18597
**Category:** Libraries
**Created:** [March 11, 2020, 1:21pm UTC](https://discourse.processing.org/t/scale-video-to-fit-canvas-size/18597 "2020-03-11T13:21:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ElwoodBlues](https://avatars.discourse-cdn.com/v4/letter/e/cc9497/32.png) [@ElwoodBlues](https://discourse.processing.org/u/ElwoodBlues)
#### Post date: [March 11, 2020, 1:21pm UTC](https://discourse.processing.org/t/scale-video-to-fit-canvas-size/18597/1 "2020-03-11T13:21:15Z")

</div>

Hello, I’m running processing on my RaspberryPi 4 with the RaspberryPi Camera Module v2.1. I am currently just capturing a video stream - see code below. My problem is that when I run the sketch, the video is very zoomed in as the resolution of the camera is obviously not scaled to the correct window size of the sketch. Seems like it should be a simple fix, however I’m quite new to this and cannot figure it out. When running it on my Mac, it scales automatically. Thought PImage resize may work but unsure how to adapt that to video. Any help would be greatly appreciated.

```auto
import processing.video.*;

Capture video;

void setup() {
  size(640, 480);

  String[] camera = Capture.list();
  video = new Capture(this, Capture.list()[0]);
  video.start();
}

void captureEvent(Capture video) {
  video.read();
}

void draw() {
  background(0);
  image(video, 0, 0);
}

```

Thanks

---

<div class="post-metadata">

### Author: ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)
#### Post date: [March 11, 2020, 1:54pm UTC](https://discourse.processing.org/t/scale-video-to-fit-canvas-size/18597/2 "2020-03-11T13:54:17Z")

</div>

You can try

```auto
image(video, 0, 0, width, height);

```

---

<div class="post-metadata">

### Author: ![ElwoodBlues](https://avatars.discourse-cdn.com/v4/letter/e/cc9497/32.png) [@ElwoodBlues](https://discourse.processing.org/u/ElwoodBlues)
#### Post date: [March 11, 2020, 2:13pm UTC](https://discourse.processing.org/t/scale-video-to-fit-canvas-size/18597/3 "2020-03-11T14:13:49Z")

</div>

thanks for the reply, just tried that but unfortunately no luck
