Skip to content

Instantly share code, notes, and snippets.

@varun04
Last active August 4, 2021 11:58
Show Gist options
  • Select an option

  • Save varun04/884af4d11234d7e1895b9d3df72db791 to your computer and use it in GitHub Desktop.

Select an option

Save varun04/884af4d11234d7e1895b9d3df72db791 to your computer and use it in GitHub Desktop.
func frameSize(at index: Int, downsamplingLevel: DownSamplingLevel = .default) -> CGSize? {
guard let properties = CGImageSourceCopyPropertiesAtIndex(imageSource, index, imageSourceOptions(with: downsamplingLevel)) as? [CFString: Any] else {
return nil
}
guard let width = properties[kCGImagePropertyPixelWidth] as? Int, let height = properties[kCGImagePropertyPixelHeight] as? Int else {
return nil
}
return CGSize(width: width, height: height)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment