<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilter-swift.class/glassDistortion()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)glassDistortionFilter"
  },
  "title" : "glassDistortion()"
}
-->

# glassDistortion()

Distorts an image by applying a glass-like texture.

```
class func glassDistortion() -> any CIFilter & CIGlassDistortion
```

## Return Value

The distorted image.

## Discussion

This method applies the glass distortion filter to an image. This effect distorts an image by applying a glass texture from the raised portions of the texture map image.

The glass distortion filter uses the following properties:

- `inputImage`: An image with the type [`CIImage`](/documentation/CoreImage/CIImage).
- `texture`: An image with the type [`CIImage`](/documentation/CoreImage/CIImage).
- `scale`: The amount of texturing to apply. Larger values increase the effect. Defaults to 200.
- `center`: A set of coordinates marking the center of the image as a <doc://com.apple.documentation/documentation/CoreFoundation/CGPoint>.

The following code creates a filter that results in a glass-like distortion applied to the image:

```swift
func glassDistortion(inputImage: CIImage, textureImage: CIImage) -> CIImage {
    let filter = CIFilter.glassDistortion()
    filter.inputImage = inputImage
    filter.textureImage = textureImage
    filter.center = CGPoint(x: 1791, y: 1344)
    filter.scale = 500
    return filter.outputImage!
}
```

![Two images arranged horizontally. The left image contains a photo of the Golden Gate Bridge with a clear sky as the backdrop. The right image shows the result of applying the glass distortion filter. It appears as though the image is behind a piece of privacy glass.](images/com.apple.coreimage/media-4407314@2x.png)

---

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)