title: Designing & Scaling New SKTexture Images for SpriteKit and iOS Applications
body: <p>I'm designing new images to be used as <code>SKTextures</code> in an iOS SpriteKit game for many different iPhones. However, I'm noticing a few discrepancies between image features (like height/ width dimensions + resolution on <em>PhotoShop</em> or <em>Preview</em>) and <em>in-game</em> pixels and points.</p>
  <p>After reading through material like this <a href="https://stackoverflow.com/questions/12019170/what-are-pixels-and-points-in-ios">stackoverflow question</a> or this <a href="https://medium.com/@peternowell/pixel-density-demystified-a4db63ba2922" rel="nofollow noreferrer">Peter Nowell Medium post</a>, I understand that &quot;points&quot; are supposed to be agnostic to screen resolution and that the engine will substitute in different image sizes based on the device (which is why we have the 1x, 2x, 3x image scales provided in Xcode Sprite Atlases).</p>
  <p>The device-to-scale mapping is outlined in <a href="https://28b.co.uk/ios-device-dimensions-reference-table/" rel="nofollow noreferrer">this reference table</a> and <a href="https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions" rel="nofollow noreferrer">this guide</a>, and it appears as though the <code>iPhone 12 Pro</code> that I'm primarily using for testing (both physically and in the Xcode Simulator) should have <strong>844x390</strong> points with a pixel density of <strong>466 PPI</strong>.</p>
  <p><a href="https://i.stack.imgur.com/0zsgm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0zsgm.png" alt="enter image description here" /></a></p>
  <p>This <a href="https://superuser.com/questions/196339/what-is-the-difference-between-pt-and-px-in-photoshop">post</a> indicates that PhotoShop follows the same rough standard for <code>points</code>, where a point is 1/72 of an inch and so I used the same point dimensions and PPI in my sprite template:</p>
  <p><a href="https://i.stack.imgur.com/eTPf1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eTPf1.png" alt="enter image description here" /></a></p>
  <p>I also add the sprite to the 3x location in the Xcode image atlas which the iPhone 12 Pro calls for:
  <a href="https://i.stack.imgur.com/zPslp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zPslp.png" alt="enter image description here" /></a></p>
  <p>I then added the image as a <code>SKSpriteNode</code> in my <code>SKScene</code>:</p>
  <pre><code> let testTexture = SKTexture(imageNamed: &quot;testingSprite390x390points_466ppi&quot;)
   let testSprite = SKSpriteNode(texture: testTexture)
   testSprite.zPosition = 100
   testSprite.position = CGPoint(x: self.frame.midX, y: self.frame.midY)
   addChild(testSprite)
  </code></pre>
  <p>(Note that in the view controller <code>view.bounds.size == (844.0, 390.0)</code> which agrees with the device-to-scale mapping article)</p>
  <p>Unfortunately, after all of this the image sprite which should have just perfectly fit in the screen (as it was 390x390 points and equal ppi) is far too large and doesn't fit on screen:</p>
  <p><a href="https://i.stack.imgur.com/NehVk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NehVk.png" alt="enter image description here" /></a></p>
  <p>If I strictly work with pixels (say 1170x1170 for iPhone 12 Pro), then everything fits as expected. Any insight into why <em>points</em> don't seem to be working or advice on whether or not I should abandon them altogether would be really appreciated.</p>