# How can i save a small canvas with high resolution 8k image file

**URL:** https://discourse.processing.org/t/how-can-i-save-a-small-canvas-with-high-resolution-8k-image-file/21422
**Category:** Coding Questions
**Tags:** homework
**Created:** [May 30, 2020, 5:46am UTC](https://discourse.processing.org/t/how-can-i-save-a-small-canvas-with-high-resolution-8k-image-file/21422 "2020-05-30T05:46:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![biard](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/biard/32/9453_2.png) [@biard](https://discourse.processing.org/u/biard)
#### Post date: [May 30, 2020, 5:46am UTC](https://discourse.processing.org/t/how-can-i-save-a-small-canvas-with-high-resolution-8k-image-file/21422/1 "2020-05-30T05:46:57Z")

</div>

> please format code with \</\> button \* [homework policy](https://discourse.processing.org/faq/#homework) \* [asking questions](https://discourse.processing.org/t/2147)

i have a canvas of 500x500 .and i want to save the canvas as a super high resolution image. but i don’t know how to do it. i don’t wanna to increase the canvas size because it become bigger then my screen.

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [May 30, 2020, 11:54am UTC](https://discourse.processing.org/t/how-can-i-save-a-small-canvas-with-high-resolution-8k-image-file/21422/2 "2020-05-30T11:54:24Z")

</div>

Hi @biard.  
You could use a PGraphics and resize it without displaying it, and then save it.

---

<div class="post-metadata">

### Author: ![biard](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/biard/32/9453_2.png) [@biard](https://discourse.processing.org/u/biard)
#### Post date: [May 31, 2020, 4:10pm UTC](https://discourse.processing.org/t/how-can-i-save-a-small-canvas-with-high-resolution-8k-image-file/21422/3 "2020-05-31T16:10:15Z")

</div>

hi there @noel can you please describe it with an example. Because i’m new in p5.js or processing.

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [May 31, 2020, 7:21pm UTC](https://discourse.processing.org/t/how-can-i-save-a-small-canvas-with-high-resolution-8k-image-file/21422/4 "2020-05-31T19:21:26Z")

</div>

In P5.java this is working quite well.  
I translated it to P5.js, but I don’t know where the file is saved.  
If you find out, tell me.

```auto
let pg;

function setup() {
  createCanvas(500, 400);
  strokeWeight(5);
  background(255); 
  pg = createGraphics(1500, 1200);
  noLoop();
}

function draw() {
  line(0, 0, width, height);
  line(0, height, width, 0);
  pg.line(0, 0, pg.width, pg.height);
  pg.line(0, pg.height, pg.width, 0);
}

function mousePressed () {
  pg.save("myImage.jpg");
}

```

---

<div class="post-metadata">

### Author: ![biard](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/biard/32/9453_2.png) [@biard](https://discourse.processing.org/u/biard)
#### Post date: [May 31, 2020, 11:15pm UTC](https://discourse.processing.org/t/how-can-i-save-a-small-canvas-with-high-resolution-8k-image-file/21422/5 "2020-05-31T23:15:21Z")

</div>

Thanks 💞 ✌ @noel it Works. i’m using visual studio code with chrome. So when i pressed the mouse it download the file.  
i think it will save in the same directory. because you haven’t specify the location of it.
