<!--
{
  "documentType" : "article",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/texture-initializers",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Texture Initializers"
}
-->

# Texture Initializers

See the various ways to create and use textures in SpriteKit.

## Discussion

Use these functions to create a new texture. While doing so, you should be aware of the memory implications of texture memory, and the other ways to get textures other than `SKTexture` initializers.

### Memory Considerations

When creating textures you should be aware of the memory consumed as a result of their file size dimensions. Often, the memory available to prepared textures is limited by hardware because textures are loaded in VRAM. Consider the following tips:

- Access a texture only when needed and dispose of it when you are done. This frees up memory for other parts of the app.
- Avoid loading too many textures in a single pass through the rendering loop. The process of decoding an image from disk is an expensive one and can therefore cause a few frames to be skipped. To avoid performance hiccups, preload textures ahead of time, such as when the scene is loaded.
- If you frequently use that same textures together (for example, all the grass tiles any time grass is displayed in a scene) then you should consider bundling them into an [`SKTextureAtlas`](/documentation/SpriteKit/SKTextureAtlas) to increase loading and runtime peformance.

### Ways to Access Textures

In addition to the [Texture Initializers](/documentation/SpriteKit/texture-initializers) in `SKTexture`, the following other classes vend textures, too:

- Access a texture by its original filename within a SpriteKit texture atlas folder using `SKTextureAtlas`’s [`textureNamed(_:)`](/documentation/SpriteKit/SKTextureAtlas/textureNamed(_:))
- Create a texture by rendering an existing node in the tree, including its children, using `SKView`’s [`texture(from:)`](/documentation/SpriteKit/SKView/texture(from:))

## Topics

### Filename Initializer

Search the app bundle for an image by filename.

[`convenience init(imageNamed: String)`](/documentation/SpriteKit/SKTexture/init(imageNamed:))

Create a new texture object from an image file stored in the app bundle.

### Texture Within a Texture

[`convenience init(rect: CGRect, in: SKTexture)`](/documentation/SpriteKit/SKTexture/init(rect:in:))

Creates a new texture from a sub-rectangle of an existing texture.

### Texture from Image

[`convenience init(image: UIImage)`](/documentation/SpriteKit/SKTexture/init(image:))

Create a new texture object from an image object.

[`convenience init(cgImage: CGImage)`](/documentation/SpriteKit/SKTexture/init(cgImage:)-27ovb)

Create a new texture object from a Quartz 2D image.

### Texture with Effects

[`func applying(CIFilter) -> Self`](/documentation/SpriteKit/SKTexture/applying(_:))

Creates a new texture by applying a Core Image filter to an existing texture.

### Texture from Data

[`convenience init(data: Data, size: CGSize)`](/documentation/SpriteKit/SKTexture/init(data:size:))

Creates a new texture from raw pixel data.

[`convenience init(data: Data, size: CGSize, rowLength: UInt32, alignment: UInt32)`](/documentation/SpriteKit/SKTexture/init(data:size:rowLength:alignment:))

Creates a new texture from custom formatted raw pixel data.

[`convenience init(data: Data, size: CGSize, flipped: Bool)`](/documentation/SpriteKit/SKTexture/init(data:size:flipped:))

Creates a new texture from raw pixel data.

### Texture from Normal Map

[`func generatingNormalMap() -> Self`](/documentation/SpriteKit/SKTexture/generatingNormalMap())

Creates a normal map texture by analyzing the contents of an existing texture.

[`func generatingNormalMap(withSmoothness: CGFloat, contrast: CGFloat) -> Self`](/documentation/SpriteKit/SKTexture/generatingNormalMap(withSmoothness:contrast:))

Creates a normal map texture by analyzing the contents of an existing texture.

### Noise Textures

[`convenience init(vectorNoiseWithSmoothness: CGFloat, size: CGSize)`](/documentation/SpriteKit/SKTexture/init(vectorNoiseWithSmoothness:size:))

Creates a new texture whose contents are procedurally generated directional noise data.

[`convenience init(noiseWithSmoothness: CGFloat, size: CGSize, grayscale: Bool)`](/documentation/SpriteKit/SKTexture/init(noiseWithSmoothness:size:grayscale:))

Creates a new texture whose contents are procedurally generated color noise data.

### Texture from Noise Map

[`convenience init(noiseMap: GKNoiseMap)`](/documentation/SpriteKit/SKTexture/init(noiseMap:))

Creates a texture from the specified noise map.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)