---
title: "CTLineGetImageBounds(_:_:)"
framework: coretext
role: symbol
role_heading: Function
path: "coretext/ctlinegetimagebounds(_:_:)"
---

# CTLineGetImageBounds(_:_:)

Calculates the image bounds for a line.

## Declaration

```swift
func CTLineGetImageBounds(_ line: CTLine, _ context: CGContext?) -> CGRect
```

## Parameters

- `line`: The line whose image bounds are calculated.
- `context`: The context for which the image bounds are calculated. This is required because the context could have settings in it that would cause changes in the image bounds.

## Return Value

Return Value A rectangle that tightly encloses the paths of the line’s glyphs, or, if the line or context is invalid, CGRectNull.

## See Also

### Measuring Lines

- [CTLineGetTypographicBounds(_:_:_:_:)](coretext/ctlinegettypographicbounds(_:_:_:_:).md)
- [CTLineGetTrailingWhitespaceWidth(_:)](coretext/ctlinegettrailingwhitespacewidth(_:).md)
