# How to stretch background image on full screen?

**URL:** <https://phaser.discourse.group/t/how-to-stretch-background-image-on-full-screen/1839>\
**Category:** Phaser 3\
**Created:** [March 26, 2019, 9:26am UTC](https://phaser.discourse.group/t/how-to-stretch-background-image-on-full-screen/1839 "2019-03-26T09:26:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LANAK](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/lanak/32/947_2.png) [@LANAK](https://phaser.discourse.group/u/LANAK)\
**Post date:** [March 26, 2019, 9:26am UTC](https://phaser.discourse.group/t/how-to-stretch-background-image-on-full-screen/1839/1 "2019-03-26T09:26:05Z")

</div>

Hello, help me please, how to stretch background image on full screen?

I use game.add.image.

Example:  
game.add.image(game.world.centerX, game.world.centerY, ‘map’).anchor.set(0.5);

- [Quote](http://www.html5gamedevs.com/topic/42460-how-to-stretch-background-image-on-full-screen/#)
- [Edit](http://www.html5gamedevs.com/topic/42460-how-to-stretch-background-image-on-full-screen/?do=edit)

---

<div class="post-metadata">

**Author:** ![yannick](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/yannick/32/732_2.png) [@yannick](https://phaser.discourse.group/u/yannick)\
**Post date:** [March 26, 2019, 11:30am UTC](https://phaser.discourse.group/t/how-to-stretch-background-image-on-full-screen/1839/2 "2019-03-26T11:30:19Z")

</div>

This should do it

```javascript
let image = this.add.image(this.cameras.main.width / 2, this.cameras.main.height / 2, 'map')
let scaleX = this.cameras.main.width / image.width
let scaleY = this.cameras.main.height / image.height
let scale = Math.max(scaleX, scaleY)
image.setScale(scale).setScrollFactor(0)

```

---

<div class="post-metadata">

**Author:** ![2gnc](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/2gnc/32/7861_2.png) [@2gnc](https://phaser.discourse.group/u/2gnc)\
**Post date:** [November 14, 2023, 3:46pm UTC](https://phaser.discourse.group/t/how-to-stretch-background-image-on-full-screen/1839/3 "2023-11-14T15:46:59Z")

</div>

Thanks! I had the same problem, this helped.
