# Change default name for right-click "Save image as..."

**URL:** https://discourse.processing.org/t/change-default-name-for-right-click-save-image-as/42245
**Category:** Beginners
**Created:** [June 18, 2023, 7:54pm UTC](https://discourse.processing.org/t/change-default-name-for-right-click-save-image-as/42245 "2023-06-18T19:54:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![guille](https://avatars.discourse-cdn.com/v4/letter/g/aeb1de/32.png) [@guille](https://discourse.processing.org/u/guille)
#### Post date: [June 18, 2023, 7:54pm UTC](https://discourse.processing.org/t/change-default-name-for-right-click-save-image-as/42245/1 "2023-06-18T19:54:48Z")

</div>

In Firefox, a p5 canvas can be saved with right click and “Save image as…”. The default name it gives is `canvas.png`. I know I could use `saveCanvas()`, but I’d like to use the native browser menu. Is there any way to set the filename from p5? I am using instance mode, so maybe it is read from some property of the p5 constructor?

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [June 19, 2023, 12:35am UTC](https://discourse.processing.org/t/change-default-name-for-right-click-save-image-as/42245/2 "2023-06-19T00:35:44Z")

</div>

> [@guille](#):
>
> The default name it gives is `canvas.png`.

Well, I went to Mozilla’s reference for tag `<canvas>` here:

> **[: The Graphics Canvas element - HTML: HyperText Markup Language | MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#result)**
>
> Use the HTML element with either the canvas scripting API or the WebGL API to draw graphics and animations.

There’s an example there, a 300x300 canvas w/ a 100x100 green square, which has been created by JS code alone w/o using any libraries.

I’ve made some changes to it so we can paste the code on any browser console:

```js
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 300;
canvas.style.backgroundColor = 'lightgray'

var ctx = canvas.getContext('2d');
ctx.fillStyle = 'green';
ctx.fillRect(10, 10, 100, 100);

document.body.appendChild(canvas);

```

If I right-click it on any Firefox-based browser and choose “Save Image As…”, default filename is always “canvas.png”.

And for Chrome-based browsers, default filename is “download.png” instead.

So it doesn’t seem we have any control of it programmatically.

That’s a browser’s user-side feature, not JS.

Maybe browsers may let us create some addon which could modify that default behavior.

But this addon option would need to be installed by the browser’s user, of course.

---

<div class="post-metadata">

### Author: ![guille](https://avatars.discourse-cdn.com/v4/letter/g/aeb1de/32.png) [@guille](https://discourse.processing.org/u/guille)
#### Post date: [June 20, 2023, 10:08am UTC](https://discourse.processing.org/t/change-default-name-for-right-click-save-image-as/42245/3 "2023-06-20T10:08:07Z")

</div>

I’ll think about other options, then. Thank you!
