# My background image won't fill up the screen. It keeps getting cropped

**URL:** <https://forums.kodeco.com/t/my-background-image-wont-fill-up-the-screen-it-keeps-getting-cropped/26439>\
**Category:** Sprite Kit\
**Created:** [February 21, 2017, 12:56am UTC](https://forums.kodeco.com/t/my-background-image-wont-fill-up-the-screen-it-keeps-getting-cropped/26439 "2017-02-21T00:56:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abd1kadir](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@abd1kadir](https://forums.kodeco.com/u/abd1kadir)\
**Post date:** [February 21, 2017, 12:56am UTC](https://forums.kodeco.com/t/my-background-image-wont-fill-up-the-screen-it-keeps-getting-cropped/26439/1 "2017-02-21T00:56:50Z")

</div>

I am working on a universal portrait game and whenever I try different CGPoint sizes, my background image gets cropped. Even width/2 and height/2 makes the image get cropped to the middle. What should the size be to fill up the whole screen for all devices?. Thanks in advance.

import SpriteKit

class GameScene: SKScene {

```
override func didMove(to view: SKView) {
    backgroundColor = SKColor.black
    
    let background = SKSpriteNode(imageNamed: "background")
    background.position = CGPoint(x: size.width/2, y: size.height/2)
    addChild(background)
    
}

```

}

 ![](https://raywenderlich-com-v3-forums.s3.amazonaws.com/original/3X/a/8/a80ab4eab5eda8f763c3f389bc1a2da5c749d8ad.png)

---

<div class="post-metadata">

**Author:** ![vimipatel](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/vimipatel/32/83106_2.png) [@vimipatel](https://forums.kodeco.com/u/vimipatel)\
**Post date:** [February 21, 2017, 7:50am UTC](https://forums.kodeco.com/t/my-background-image-wont-fill-up-the-screen-it-keeps-getting-cropped/26439/2 "2017-02-21T07:50:24Z")

</div>

Hello @abd1kadir

Just add one line, give size to `SKSpriteNode` same as screen size.

```
background.size = view.frame.size //self.frame.size //self.view.frame.size

```

or

```
background.size = UIScreen.main.bounds.size

```

Just like :

```
let background = SKSpriteNode(imageNamed: "background")
background.size = view.frame.size //self.frame.size //self.view.frame.size
background.position = CGPoint(x: size.width/2, y: size.height/2)
addChild(background)

```

---

<div class="post-metadata">

**Author:** ![abd1kadir](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@abd1kadir](https://forums.kodeco.com/u/abd1kadir)\
**Post date:** [February 21, 2017, 6:40pm UTC](https://forums.kodeco.com/t/my-background-image-wont-fill-up-the-screen-it-keeps-getting-cropped/26439/3 "2017-02-21T18:40:57Z")

</div>

Thanks for the reply but it is not working. This is what I keep getting

 ![](https://raywenderlich-com-v3-forums.s3.amazonaws.com/original/3X/2/6/2605a5c63fba054c659592de70150b88927750b6.png)

---

<div class="post-metadata">

**Author:** ![slogbelly](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/slogbelly/32/83319_2.png) [@slogbelly](https://forums.kodeco.com/u/slogbelly)\
**Post date:** [May 10, 2020, 5:09pm UTC](https://forums.kodeco.com/t/my-background-image-wont-fill-up-the-screen-it-keeps-getting-cropped/26439/4 "2020-05-10T17:09:49Z")

</div>

I presume you figured this out already but I just discovered the solution and thought I’d put it here in the event someone else had this problem.  
When I set up the SKScene itself attached to the SKView, I had to make the scene the same size as the screen.

let scene = myScene(size: UIScreen.main.bounds.size)  
let skView = self.view as! SKView  
skView.ignoresSiblingOrder = true  
scene.scaleMode = .aspectFill  
skView.presentScene(scene)

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [July 6, 2020, 3:50am UTC](https://forums.kodeco.com/t/my-background-image-wont-fill-up-the-screen-it-keeps-getting-cropped/26439/6 "2020-07-06T03:50:58Z")

</div>

@slogbelly Thank you for sharing your solution - much appreciated!
