<!--
{
  "availability" : [
    "macOS: 10.9.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIImage/init(texture:size:flipped:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIImage(im)initWithTexture:size:flipped:options:"
  },
  "title" : "init(texture:size:flipped:options:)"
}
-->

# init(texture:size:flipped:options:)

Initializes an image object with data supplied by an OpenGL texture.

```
init(texture name: UInt32, size: CGSize, flipped: Bool, options: [CIImageOption : Any]? = nil)
```

## Parameters

`name`

An OpenGL texture. Because [`CIImage`](/documentation/CoreImage/CIImage) objects are immutable, the texture  must remain unchanged for the life of the image object. See the discussion for more information.

`size`

The dimensions of the texture.

`flipped`

`true` to have Core Image flip the coordinates of the texture vertically to convert between OpenGL and Core Image coordinate systems.

`options`

A dictionary specifying image options. (See `Image Dictionary Keys`.)

## Return Value

The initialized image object.

## Discussion

When using a texture to create a [`CIImage`](/documentation/CoreImage/CIImage) object, the texture must be valid in the Core Image context ([`CIContext`](/documentation/CoreImage/CIContext)) that you draw the [`CIImage`](/documentation/CoreImage/CIImage) object into. This means that one of the following must be true:

- The texture must be created using the `CGLContext` object that the [`CIContext`](/documentation/CoreImage/CIContext) is based on.
- The context that the texture was created in must be shared with the `CGLContext` that the [`CIContext`](/documentation/CoreImage/CIContext)is based on.

Note that textures do not have a retain and release mechanism. This means that your application must make sure that the texture exists for the life cycle of the image. When you no longer need the image, you can delete the texture.

Core Image ignores the texture filtering and wrap modes (`GL_TEXTURE_FILTER` and `GL_TEXTURE_WRAP`) that you set through OpenGL. The filter and wrap modes are overridden by what the CISampler object specifies when you apply a filter to the [`CIImage`](/documentation/CoreImage/CIImage) object.

## See Also

[`imageWithTexture:size:flipped:options:`](/documentation/CoreImage/CIImage/imageWithTexture:size:flipped:options:)

Creates and returns an image object initialized with data supplied by an OpenGL texture.



---

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)