Function

UIGraphicsGetImageFromCurrentImageContext()

Returns an image based on the contents of the current bitmap-based graphics context.

Declaration

func UIGraphicsGetImageFromCurrentImageContext() -> UIImage?

Return Value

A image object containing the contents of the current bitmap graphics context.

Discussion

You should call this function only when a bitmap-based graphics context is the current graphics context. If the current context is nil or was not created by a call to UIGraphicsBeginImageContext(_:), this function returns nil.

This function may be called from any thread of your app.

See Also

Image Creation

func UIGraphicsBeginImageContext(CGSize)

Creates a bitmap-based graphics context and makes it the current context.

func UIGraphicsEndImageContext()

Removes the current bitmap-based graphics context from the top of the stack.

func jpegData(compressionQuality: CGFloat) -> Data?

Returns a data object containing the specified image in JPEG format.

func pngData() -> Data?

Returns a data object containing the specified image in PNG format