<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: 10.9.0 - 10.14.0",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIImage/imageWithTexture:size:flipped:options:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIImage(cm)imageWithTexture:size:flipped:options:"
  },
  "title" : "imageWithTexture:size:flipped:options:"
}
-->

# imageWithTexture:size:flipped:options:

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

```
+ (CIImage *) imageWithTexture:(unsigned int) name size:(CGSize) size flipped:(BOOL) flipped options:(NSDictionary<NSString *,id> *) options;
```

## 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

An image object initialized with the texture data.

## 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 Core Image context is based on.
- The context that the texture was created in must be shared with the `CGLContext` that the Core Image context 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`](/documentation/CoreImage/CISampler) object specifies when you apply a filter to the [`CIImage`](/documentation/CoreImage/CIImage) object.

---

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)